Partager via


And Element

Within the Where element, the And element is used to group filters in a query for a view.

Syntax

<And>
</And>

Element Relationships

Parent Elements Child Elements
And, Or, Where And, BeginsWith, Contains, DateRangesOverlap, Eq, Geq, Gt, IsNotNull, IsNull, Leq, Lt, Neq, Or

Remarks

This element can be nested inside other And and Or elements. The server supports arbitrarily 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>