Menu

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.

Open source Enterprise

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

image image

Variable setup - multi

image image

Without filter

image image image

With single filter

We are using the filter region == "${region}"

image

With multi filter

We are using the filter region IN (${region_multi:singlequote}) to show multiple regions

image

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

image

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

uql
parse-json
| summarize count("name") by "region"

UQL - With single filter

uql
parse-json
| where "region" == '$region'
| summarize count("name") by "region"

UQL - With single filter (JSONata)

uql
parse-json
| jsonata "$[region='${region}']"
| summarize count("name") by "region"

UQL - With multi filter

uql
parse-json
| where "region" in (${region_multi:singlequote})
| summarize count("name") by "region"

UQL - Multi filter (JSONata)

uql
parse-json
| jsonata "$[region in [${region_multi:singlequote}]]"
| summarize count("name") by "region"

UQL - Multi filter (NOT IN)

uql
parse-json
| where "region" !in (${region_multi:singlequote})
| summarize count("name") by "region"

UQL - Multi filter (NOT IN) (JSONata)

uql
parse-json
| jsonata "$[$not(region in [${region_multi:singlequote}])]"
| summarize count("name") by "region"