I have an if statement below that produces a "Yes".
${if (1>=0)} Yes${/}
I have a query statement below that produces a "1".
${Inspection | where:"status='Deficient'" | stats:"count, q_2"}
I am unable to place the query inside the if statement without getting errors - mostly unclosed or unopened.
How do I combine the two?
In Survey123 report templates you can’t nest a where | stats query inside an if statement because queries are evaluated separately, which causes parsing errors. Instead, run the query first, assign the result to a variable, and then use that variable in the if condition, like this:
${Inspection | where:"status='Deficient'" | stats:"count" | assign:"defCount"}
${if defCount > 0}Yes${/}