I'm trying to do a complex filter in a list view. I'm used to boolean searches and using parenthesis to make sure that the AND/OR are executed in the correct order. But I can't figure out how to enter the filters in the UI. The filter I want is
(Condition1 OR Condition2 OR Condition3 OR Condition4) AND (Condition5 OR Condition6)
I've opened the list view aspx page in SharePoint designer to see how the CAML query is and it looks somethine like this.
<Where>
<Or>
<And>
<Or>
<Or>
<Or>
<Eq>
Condition1
</Eq>
<Eq>
Condition2
</Eq>
</Or>
<Eq>
Condition3
</Eq>
</Or>
<Eq>
Condition4
</Eq>
</Or>
<Eq>
Condition5
</Eq>
</And>
<Eq>
Condition6
</Eq>
</Or>
</Where>
Which works out to the following (I think).
(Condition1 OR Condition2 OR Condition3 OR Condition4) AND Condition5 OR Condition6
I've tried moving the and , but I just can't wrap my head around how to get what I want.
I've search and found several recommendations for tools like SP CAML Query Helper, but it only helps write out the statements...you still need to know what order to put them in.
Can anybody help me make sense of this and how I can structure what I want either by editing the CAML query or using the web UI?
Additional tests
I also found this thread. Based on that suggestion I tried the following, which seemed to work when I put it into the query using SharePoint Designer.
<Where>
<And>
<Or>
<Or>
<Or>
<Eq>
Condition1
</Eq>
<Eq>
Condition2
</Eq>
</Or>
<Eq>
Condition3
</Eq>
</Or>
<Eq>
Condition4
</Eq>
</Or>
<Or>
<Eq>
Condition5
</Eq>
<Eq>
Condition6
</Eq>
</Or>
</And>
</Where>
Unfortunately when I added a new column to the view using the web interface, the query was mangled and stopped working.
So additionally, I need a solution that will either work through SPD or web interface, but won't get mangled if the web interface is used again.