AnsweredAssumed Answered

What are the correct parentheses syntax rules for app queries?

Question asked by Becky_Medley Employee on Mar 1, 2016
Latest reply on Mar 3, 2016 by DavidAditutori1351530
According to the help page for Building App Queries, the syntax rules for parentheses are:
"Parentheses used in queries with multiple conditions must be balanced.. For every condition in the query, you must add one ( to the front of the string. You must also end each condition beyond the first with ))."

But the default query in the "My Tasks" app doesn't follow these rules. It has this:
((State != Completed) AND ((Owner = {user}) AND ((Iteration.StartDate <= today) AND (Iteration.EndDate >= today))))

I modified this to add a condition to only show Tasks that have the Ready flag marked True, and came up with this. It works, but it still does not follow the rules stated above. 
((State != Completed) AND ((Owner = {user}) AND ((Ready = True) AND ((Iteration.StartDate <= today) AND (Iteration.EndDate >= today)))))

It almost seems like the rules are backwards since the double parentheses starts another condition instead of ending them with double parentheses.

I moved around the parentheses to go by these rules and it also works, so what is really needed for parentheses?
( ( ( ( (State != Completed) AND (Owner = {user}) ) AND (Ready = True) ) AND (Iteration.StartDate <= today) ) AND (Iteration.EndDate >= today))

 

Outcomes