Skip to main content
adrians0003
October 19, 2021
Question

Filtering by multiple conditions

  • October 19, 2021
  • 3 replies
  • 1 view

Hi. I need to learn how to apply multiple conditions to a query filter as illustrated below. What is the correct syntax to achieve this as the compiler suggests there is an issue but the test call seemed to work. Thanks.

3 replies

joshl
October 19, 2021

if you need more than one query filter use the logicalExpression parameter of a!queryEntity(). You can add multiple query filter objects that way.

New Participant
October 19, 2021

Please refer the code sample in Multiple Conditions

mikes0011
Brainy
October 19, 2021

As Josh already mentioned, you need to use the logicalExpressions parameter (passing in an array of a!queryLogicalExpression() objects, which can be nested to many levels if really needed).  This concept is needed when applying more than one filter because otherwise Appian has no way of knowing whether to require ALL of the filters or ANY; the logical expression allows you to set the filtering behavior to either "AND" or "OR", which will accomplish these.  What's neat about this is that through well-planned nesting and combination of operators, you can accomplish some surprisingly graceful querying combinations.

Just out of curiosity tho, what gave you the impression that parameters like "field2, operator2" etc would be valid?

The Expression Guru