Or Element (Query)
Published: May 2010
Used within the Where element to group filters in a query.
This element can be nested inside other Or and And elements. The server supports unlimited complicated queries. However, any given Or element can have only two disjuncts; that is, only two child elements. If you need to disjoin three or more conditions, you must nest the Or elements, as demonstrated by the second example in the following section.
The following example performs a query for cases in which values of the Status field either do not equal Completed or are null. The results are sorted in descending order according to the Modified field.
<Query> <OrderBy> <FieldRef Name="Modified" Ascending="FALSE"></FieldRef> </OrderBy> <Where> <Or> <Neq> <FieldRef Name="Status"></FieldRef> <Value Type="Text"></Value> </Neq> <IsNull> <FieldRef Name="Status"></FieldRef> </IsNull> </Or> </Where> </Query>
The following example shows how to disjoin three conditions. Note that the first pair of conditions are within their own Or element, which is itself a condition of an outer Or element.