Expressions in Filters
An expression <Expr> element allows a complex filter to be written consisting of multiple selection conditions. You can specify logical AND and OR operators in order to build up filters of any complexity. An <Expr> element can contain two <Item> elements, two <Expr> elements, or one <Item> element and one <Expr> element.
An example of a complex filter is shown below:
<Filter> <Expr operator="OR"> <Expr operator="AND"> <Item name="/PurchaseOrder/EntryDate" operator="EQU" value="02042001"/> <Item name="/PurchaseOrder/SupplierCode" operator="EQU" value="71003"/> </Expr> <Expr operator="AND"> <Item name="/PurchaseOrder/EntryDate" operator="EQU" value="26032001"/> <Item name="/PurchaseOrder/SupplierCode" operator="EQU" value="71010"/> </Expr> </Expr> </Filter>
This is equivalent to the following query:
If ((Entry Date = 02/04/2001) and (Supplier code = 71003)) OR
((Entry Date = 26/03/2001) and (Supplier code = 71010)).
Selection conditions are evaluated from left to right and from the innermost selection condition outwards. We recommend that each selection condition is specified within an <Expr> element.