The $filter query option defines a filter for the ODATA GET command.
$filter=[left property] [operator] [right property] [ logical operator or/and [left property] [operator] [right property] ] ...
The left and right properties can take the following values:
•String, for example "1234"
•Number, for example 1.442
•Entity, for example Item or Item/ItemCode
•Function, for example concat(x,y)
The following operators are supported:
Operator |
Description |
Example |
---|---|---|
Logical Operators |
||
eq |
Equal |
/Suppliers?$filter=Address/City eq 'Redmond' |
ne |
Not equal |
/Suppliers?$filter=Address/City ne 'London' |
gt |
Greater than |
/Products?$filter=Price gt 20 |
ge |
Greater than or equal |
/Products?$filter=Price ge 10 |
lt |
Less than |
/Products?$filter=Price lt 20 |
le |
Less than or equal |
/Products?$filter=Price le 100 |
Note: Beas supports <, >, >=, <= and <> as well.
Additional operators for strings that are not compatible with the ODATA syntax:
Operator |
Description |
||
like |
SQL like ItemName like "red" |
/Item?$filter=ItemName like "red" |
|
startwith |
string starts with ...ItemName startwith "A00" |
/Item?$filter=ItemName startwith "A00" |
|
endwith |
string ends with... ItemName endwith "001" |
/Item?$filter=ItemName endwith "001" |
|
"n" Operator Prefix neq, nne, ngt ... |
|
/Workorder?$filter=DocEntry neq "1038" |
The following logical operators are supported:
Logical Operator |
Description |
|
and |
Combines two Boolean expressions and returns TRUE when both expressions are TRUE. |
OnHand gt 10 and ItemCode gt "A" |
or |
Combines two conditions. When more than one logical operator is used in a statement, it returns TRUE. |
OnHand gt 10 or ItemCode gt "A" |
Brackets are allowed, for example: ((a eq "1" or a eq "2") and b eq "3") or b eq "4".
Functions
Logical Operator |
Description |
||
concat |
|
WorkorderBom& |
Brackets are allowed, for example: Item?$filter=(ItemCode gt "A" and ItemCode lt "C") or ItemCode gt "D"
Compatibility:
Currently, the ODATA function calls are not working in the Beas Service Layer. You can use additional operators like, startwith, and so on.