Skip to content
Last updated

Using filter expressions with OData semantics

Operators

The Knowledge Model API supports a subset of OData filter operators. Note that all operators must be written in lowercase to comply with OData syntax requirements.

Comparison operators

OperatorDescriptionExamples
eqEqualCity eq 'Redmond'
City eq 'St. John''s'
neNot equalCity ne 'London'
City ne 'King''s Cross'
gtGreater thanPrice gt 20
geGreater than or equalPrice ge 10
ltLess thanPrice lt 20
leLess than or equalPrice le 100
inIs a member ofCity in ('Redmond', 'London')

Logical operators

OperatorDescriptionExamples
andLogical andPrice le 200 and Price gt 3.5
orLogical orPrice le 3.5 or Price gt 200
notLogical negationnot endswith(Description,'milk')

Grouping operators

OperatorDescriptionExamples
()Precedence grouping(Price eq 5) or (City eq 'London')

String functions

FunctionExamples
containscontains(CompanyName,'freds')
contains(LastName,'O''Neil')
endswithendswith(CompanyName,'Futterkiste')
startswithstartswith(CompanyName,'Alfr')

Escaping single quotes in string literals

Note that single quotes within string literals must be represented as two consecutive single quotes.

Example:

O'Leary is represented as O''Leary.

For more information, see the OData syntax rules here.

Filter expressions and types

The filter expressions will be sensitive to the expressions field’s types. Below is a table outlining the supported types and examples of appropriate filter expressions.

Celonis Data TypeCelonis Data FormatFilter ExampleFilter results (mapping to PQL)
StringStandard (No format)
Name eq 'John Doe'
“TABLE”.“Name” = `John Doe`
Boolean True/False
Active eq true
“TABLE”.“Name” = ‘John Doe’
Yes/No
0/1
Integer Standard (No format)
Age eq 10
“TABLE”.“Age” = 10
Rounded (,.0f)
Percentage (%)
Decimal Number (#.##)
Abbreviated (##.#k)
Float Standard (No format)
Ratio eq 10.2
“TABLE”.“Ratio” = 10.2
Rounded (,.0f)
Percentage (%)
Decimal Number (#.##)
Abbreviated (##.#k)
Date Standard (No format)
Date eq 2015-05-07
TO_STRING(“TABLE”.“Date”, FORMAT (‘%Y-%m-%d’)) = ‘2015-05-07’
Date (Y-M-D)
Date and Time (Y-M-D H:M)
Time or DateTime or Timestamp Standard (No format)
Date eq 2023-12-05T15:48:44Z
Date eq 2023-12-05T15:48Z
Date eq 2023-12-05T15:48+03:00
TO_STRING(“TABLE”.“Date”, FORMAT (‘%Y-%m-%d %H:%M:%S’)) = ‘2015-05-07 15:48:44’
TO_STRING(“TABLE”.“Date”, FORMAT (‘%Y-%m-%d %H:%M’)) = ‘2015-05-07 15:48’
Date (Y-M-D)
Date and Time (Y-M-D H:M)
Time (H:M)

Using the filterExpr parameter

To filter data of a single record of a given Knowledge Model

To filter the data of a specific Knowledge Model Record, you can use the Knowledge Model API's Getting Record Data endpoint. This is useful when you want to retrieve a subset of the record's data based on certain conditions. The endpoint uses the filterExpr parameter to apply filters. Here's how it works:

Single filterExpr parameter

You can combine multiple filter conditions into a single filterExpr parameter using the and operator.
Example: filterExpr=active eq true and name eq ‘John Doe’

Multiple filterExpr parameter

The API also supports providing multiple filterExpr parameters. The API automatically combines these with the and operator, achieving the same result as the single-parameter method.

Example: filterExpr=active eq true&filterExpr=name eq ‘John Doe’

Important Notes

  • The field identifier used in your filter expression is the attribute ID from Celonis Studio.
  • Attribute IDs are case-sensitive. Be sure to match the casing exactly as it appears in Celonis Studio.

To filter data of any record and/or KPI of a given Knowledge Model

To filter the data from different records of a Knowledge Model and combine them with KPIs (Key Performance Indicators), you can use the Knowledge Model API's Getting Knowledge Model Data endpoint.

It uses the filterExpr parameter to introduce filter expressions, providing greater flexibility when querying different data within the Knowledge Model. To achieve this, you must specify both the record and the field to filter, allowing you to combine fields from different records within the same Knowledge Model. Here's how it works:

Single filterExpr parameter

You can combine multiple filter conditions into a single filterExpr parameter using the and operator.

Example: filterExpr=activities.name eq ‘Release Order’ and users.active eq true

Multiple filterExpr parameter

The API also supports providing multiple filterExpr parameters. The API automatically combines these with the and operator, achieving the same result as the single-parameter method.

Example: filterExpr=activities.name eq ‘Release Order’&filterExpr=users.active eq true

Important Notes

  • The field identifier used in your filter expression is the record ID and attribute ID from Celonis Studio.
  • Record IDs and Attribute IDs are case-sensitive. Be sure to match the casing exactly as they appear in Celonis Studio.