where
The where function filters an array, keeping only the items for which a given expression evaluates to true. The expression is evaluated once per item, with that item as its scope, so you can reference each item’s own fields by name.
Syntax
Section titled “Syntax”{input | where:"expression"}Parameters
Section titled “Parameters”input(array): The array to filter, for examplevulnerabilities,affected_hosts, orcategories.expression(string): An expression evaluated for each item; the item is kept when the result is truthy. The item’s properties are available by name. Supports comparisons (===,!==,==,!=,>,>=,<,<=), logical operators (&&,||,!), and property access (remediation_stage,cvss_score,extra_fields['Summary']).
Returns
Section titled “Returns”- A new array containing only the items for which the expression evaluated to
true. - The original array is not modified.
- If no items match, an empty array is returned (a loop over it renders nothing; pipe the result to
isNotEmptyto get a true/false value).
Examples
Section titled “Examples”Keep only vulnerabilities that are not remediated
Section titled “Keep only vulnerabilities that are not remediated”{vulnerabilities | where:"remediation_stage !== 'completed'"}// Input: [{"title": "SQLi", "remediation_stage": "completed"}, {"title": "XSS", "remediation_stage": "in_progress"}, {"title": "CSRF", "remediation_stage": null}]// Returns: [{"title": "XSS", "remediation_stage": "in_progress"}, {"title": "CSRF", "remediation_stage": null}]Keep only vulnerabilities currently being retested
Section titled “Keep only vulnerabilities currently being retested”{vulnerabilities | where:"remediation_stage === 'in_progress'"}Filter by CVSS score
Section titled “Filter by CVSS score”{vulnerabilities | where:"cvss_score >= 7"}Combine conditions
Section titled “Combine conditions”{vulnerabilities | where:"cvss_score >= 7 && remediation_stage !== 'completed'"}Match on an extra field
Section titled “Match on an extra field”{vulnerabilities | where:"extra_fields['Summary'] === 'Reflected'"}Use inside a loop
Section titled “Use inside a loop”{#vulnerabilities | where:"remediation_stage !== 'completed'"}#{order_id} {title}{/}Show a section only when matching items exist (with isNotEmpty)
Section titled “Show a section only when matching items exist (with isNotEmpty)”{#(vulnerabilities | where:"remediation_stage !== 'completed'" | isNotEmpty)}The following vulnerabilities are still active:{#vulnerabilities | where:"remediation_stage !== 'completed'"}#{order_id} {title} - {~extra_fields['Summary']}{/}{/}- Use straight quotes (
"and'), not the “smart quotes” a word processor inserts automatically. Smart quotes break the expression. whereoperates on arrays. Applying it to a value that is not an array leaves the tag unrendered.- Wrap the expression in double quotes and use single quotes for string values inside it, as in the examples.
remediation_stagevalues arecompleted(Remediated),in_progress(Retesting),requested,partial, andnull(Not Remediated). “Not remediated” means anything other thancompleted.
Use Cases
Section titled “Use Cases”- Listing only unresolved (not remediated) findings in a summary section
- Building severity-specific tables (for example, only High/Critical by CVSS)
- Driving conditional sections together with
isNotEmpty - Narrowing any repeated list (hosts, categories, findings) to a subset before looping