OData supports various kinds of filter options for querying data and $filter allows clients to filter a collection of result that are
getting by requested oData URL.
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
|
And
|
Logical and
|
/Products?$filter=Price
le 200 and Price gt 3.5
|
Or
|
Logical or
|
/Products?$filter=Price
le 3.5 or Price gt 200
|
Not
|
Logical negation
|
/Products?$filter=not
endswith(Description,'milk')
|
Arithmetic Operators
|
||
Add
|
Addition
|
/Products?$filter=Price
add 5 gt 10
|
Sub
|
Subtraction
|
/Products?$filter=Price
sub 5 gt 10
|
Mul
|
Multiplication
|
/Products?$filter=Price
mul 2 gt 2000
|
Div
|
Division
|
/Products?$filter=Price
div 2 gt 4
|
Mod
|
Modulo
|
/Products?$filter=Price
mod 2 eq 0
|
Grouping Operators
|
||
( )
|
Precedence grouping
|
/Products?$filter=(Price
sub 5) gt 10
|
No comments:
Post a Comment