Creating Filters in a Text Editor
If you are creating or maintaining query payloads using a text editor, the filter element takes the general form:
<Filter>
<Item name="elementname" operator="filteroperator" value="value"/>
</Filter>
The general rules for valid filters are as follows:
- A filter must have each selection condition specified within an <Item> element.
- A selection condition within an
<Item>
element must have:- A name that identifies the element to be used.
- An operator describing the type of selection operation to be applied to the element.
- One or more parameters (depending on the operator) specifying the value(s) that the database is compared with. You can use wild cards.
Where you are selecting a child element, you must include all the parent elements in the element name portion of the name="elementname" parameter.
<component>
<Element1></Element1>
<Child1>
<Element2></Element2>
<Child1a>
<Element3></Element3>
</Child1a>
</Child>
</component>
To select on <Element1>, specify name="elementname" as name="/Component/Element1"
To select on <Element2>, specify name="elementname" as name="/Component/Child1/Element2"
To select on <Element3>, specify name="elementname" as name="/Component/Child1/Child1a/Element3"
The following table shows a sample filter for each filter operator:
Filter Operator | Example |
Equal | <Filter> <Item name="/Ledger/LedgerLine/AssetCode" operator="EQU" value="V001"/> </Filter> |
OR | <Filter> <Expr operator="OR"> <Item name="/Ledger/LedgerLine/JournalNumber" operator="EQU" value="1100"/> <Item name="/Ledger/LedgerLine/JournalNumber" operator="EQU" value="1300"/> </Expr> </Filter> |
AND | <Filter> <Expr operator="AND"> <Item name="/Ledger/LedgerLine/JournalNumber" operator="EQU" value="1100"/> <Item name="/Ledger/LedgerLine/JournalNumber" operator="EQU" value="1300"/> </Expr> </Filter> |
Not Equal | <Filter> <Item name="/Ledger/LedgerLine/AssetCode" operator="NEQU" value="V001"/> </Filter> |
Greater than | <Filter> <Item name="/Ledger/LedgerLine/AssetCode" operator="GT" value="V001"/> </Filter> |
Greater than or Equal | <Filter> <Item name="/Ledger/LedgerLine/AssetCode" operator="GTE" value="V001"/> </Filter> |
Less than | <Filter> <Item name="/Ledger/LedgerLine/AssetCode" operator="LT" value="V001"/> </Filter> |
Less than or Equal | <Filter> <Item name="/Ledger/LedgerLine/AssetCode" operator="LTE" value="V201"/> </Filter> |
Between | <Filter> <Item name="/Ledger/LedgerLine/AssetCode" operator="BETWEEN" minvalue="V001" maxvalue="V9999"/> </Filter> |
In | <Filter> <Item name="/Supplier/SupplierCode" operator="IN" value="71001,71002,71003"/> </Filter> |
Like | <Filter> <Item name="/Ledger/LedgerLine/AssetCode" operator="LIKE" value="_001"/> </Filter> <Filter> <Item name="/Ledger/LedgerLine/AssetCode" operator="LIKE" value="V%"/> </Filter> |
Is Null | <Filter> <Item name="/Ledger/LedgerLine/AssetCode" operator="NULL" /> </Filter> |
Is Not Null | <Filter> <Item name="/Ledger/LedgerLine/AssetCode" operator="NOTNULL"/> </Filter> |
Days Relative To Today | <Filter> <Item name="/Accounts/DateTimeLastUpdated" operator="RELDAYS" minvalue="-2" maxvalue="0"/> </Filter> |