Important: This documentation is about an older version. It's relevant only to the release noted, many of the features and functions have been updated or replaced. Please view the current version.
Filtering data / Using template variables in Query
In order to filter the data in Infinity datasource, you can use the following options based on the parser you are using.
Note: All these filtering will happen after retrieving the content. For better performance, use the filtering at your API
Filtering with Backend Parser
When using the backend parser, use the following examples for filtering your data. In most cases you will be filtering data based on single value or multiple value variable.
Variable setup - single
Variable setup - multi
Without filter
With single filter
We are using the filter region == "${region}"
With multi filter
We are using the filter region IN (${region_multi:singlequote})
to show multiple regions
With multi filter (NOT IN)
We are using the filter !(region IN (${region_multi:singlequote})
to exclude multiple regions. As you see we use ! symbol before our condition
Filtering with UQL Parser
When using the backend parser, use the following examples for filtering your data. In most cases you will be filtering data based on single value or multiple value variable.
UQL - Without filter
parse-json
| summarize count("name") by "region"
UQL - With single filter
parse-json
| where "region" == '$region'
| summarize count("name") by "region"
UQL - With single filter (JSONata)
parse-json
| jsonata "$[region='${region}']"
| summarize count("name") by "region"
UQL - With multi filter
parse-json
| where "region" in (${region_multi:singlequote})
| summarize count("name") by "region"
UQL - Multi filter (JSONata)
parse-json
| jsonata "$[region in [${region_multi:singlequote}]]"
| summarize count("name") by "region"
UQL - Multi filter (NOT IN)
parse-json
| where "region" !in (${region_multi:singlequote})
| summarize count("name") by "region"
UQL - Multi filter (NOT IN) (JSONata)
parse-json
| jsonata "$[$not(region in [${region_multi:singlequote}])]"
| summarize count("name") by "region"