Skip to main content
sugithrag
June 15, 2026
Solved

applyWhen queryLogicalExpression not working

  • June 15, 2026
  • 7 replies
  • 3 views

Hi, Im facing an issue in queryLogicalExpression where 'AND' operator is used and there are 3 query filters in it with applyWhen parameter is passed which is evaluated as false in all the 3 filters but still this expression got executed instead of ignoring it. Is the applyWhen parameter will work only for separate queryFilter and not for the filters added in logical expression? Could someone help me to understand the behaviour?

Thanks

Best answer by amaans4178

Yes, applyWhen absolutely works inside a!queryLogicalExpression().

The reason your query is still running instead of being ignored is : When all filters inside a logical expression evaluate to false, Appian empties the list entirely. In Appian, an empty filter list doesn’t mean "ignore this query" or "return nothing", it means "return everything." The system treats it as a blank canvas with no restrictions, which is why your query still executes and fetches data.

could u give us more clarity on how and where you are applying the applywhen parameter. a code snippet would be helpful.

7 replies

June 15, 2026

The Are You a Charlotte? Podcast 2026 Kristin Davis Leopard Print Sweater gives off a stylish yet relaxed vibe. I appreciate clothing pieces that make a statement without requiring a lot of accessories, and this sweater seems to do exactly that while remaining comfortable for regular wear.

amaans4178
June 15, 2026

Yes, applyWhen absolutely works inside a!queryLogicalExpression().

The reason your query is still running instead of being ignored is : When all filters inside a logical expression evaluate to false, Appian empties the list entirely. In Appian, an empty filter list doesn’t mean "ignore this query" or "return nothing", it means "return everything." The system treats it as a blank canvas with no restrictions, which is why your query still executes and fetches data.

could u give us more clarity on how and where you are applying the applywhen parameter. a code snippet would be helpful.

sugithrag
sugithragAuthor
June 15, 2026

Sure, it's a nested expression where in all the queryLogicalExpression highlighted in the box contain applyWhen parameter and it is false so I've expected the top level queryLogicalExpression (highlighted in yellow) should be skipped

amaans4178
June 15, 2026

To make the yellow expression block disappear entirely when those conditions are met, you need to lift the applyWhen logic up to the parent layer. Instead of calling this parameter inside the individual a!queryFilter blocks, you must apply it directly to the top-level a!queryLogicalExpression that you want skipped.

Note : if you want an entire logical block (like the one highlighted in yellow) to be ignored based on a condition, the applyWhen must live on that specific block. Relying on inner filters to turn false will only clear out those specific inner filters, leaving the outer OR structure active and running.

July 15, 2026

applyWhen works only on the individual a!queryFilter(), not on the entire a!queryLogicalExpression().

If applyWhen is false, that filter is simply removed from the query. When all the filters inside the logical expression are removed, Appian still processes the queryLogicalExpression()—it just has no filters to apply, so the query runs without those conditions.