And Element (Query)
This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
Used within the Where element to group filters in a query for a view.
<And>
</And>
Attributes
Attribute |
Description |
---|---|
None |
N/A |
Child Elements
And, BeginsWith, Contains, DateRangesOverlap, Eq, Geq, Gt, IsNotNull, IsNull, Leq, Lt, Membership, Neq, Or |
Parent Elements
Occurrences
Minimum: 0 Maximum: Unbounded |
Remarks
This element can be nested inside other And and Or elements. The server supports unlimited complicated queries.
Example
The following example conveys criteria for a query on the ProductID field: (ProductID = J1539 AND ProductID = J9862) AND (ProductID = J0394 OR ProductID = J4589).
<And>
<And>
<Eq>
<FieldRef Name="ProductID"/>
<Value Type="Text">J1539</Value>
</Eq>
<Eq>
<FieldRef Name="ProductID"/>
<Value Type="Text">J9862</Value>
</Eq>
</And>
<Or>
<Eq>
<FieldRef Name="ProductID"/>
<Value Type="Text">J0394</Value>
</Eq>
<Eq>
<FieldRef Name="ProductID"/>
<Value Type="Text">J4589</Value>
</Eq>
</Or>
</And>
The following example performs a query for cases in which values of the Status field do not equal Completed and values of the Sent field are null. The records returned are sorted in descending order according to values of the Modified field.
<Query>
<OrderBy>
<FieldRef Name="Modified" Ascending="FALSE"></FieldRef>
</OrderBy>
<Where>
<And>
<Neq>
<FieldRef Name="Status"></FieldRef>
<Value Type="Text">Completed</Value>
</Neq>
<IsNull>
<FieldRef Name="Sent"></FieldRef>
</IsNull>
</And>
</Where>
</Query>