Sharepoint - How does SharePoint handle AND / OR view filtering?

Actually, at least on SharePoint 2007, when you're using the GUI, your filters are going to be applied and grouped in the order they were entered, ignoring the "AND before OR" rule.

So, in your case:

1 || 2 && 3 && 4

will be treated like:

( ( 1 || 2 ) && 3 ) && 4 <=> ( 1 || 2 ) && 3 && 4

Which would give you the results you were expecting because you entered them in the correct order.

If you instead entered them in in the order:

4 && 3 && 2 || 1

It would be interpreted as:

( ( 4 && 3 ) && 2 ) || 1 <=> 1 || (2 && 3 && 4)

If you open up the CAML, you can see what the GUI is doing. Here's a blog post that walks through this with pictures and an example CAML (and how to see your own).


The formula computation in your case will be - Rule 1 || (Rule 2 && Rule 3 && Rule 4) The conditions in operators are grouped such that the higher precedence is given to 'and' operator, followed by 'or'.

You can also check in the CAML Designer how the query is formed to validate your desired result before creating a view filter.