Operator | Description | Example | Requests... |
eq | Equals | http://localhost:5555/odata/ OData.svc/Customers? $filter=Name eq ‘Smith’ | All customers whose name is ‘Smith’. |
ne | Not equal | http://localhost:5555/odata/ OData.svc/Customers? $filter=Name ne ‘Smith’ | All customers whose name is not ‘Smith’. |
gt | Greater than | http://localhost:5555/odata/ OData.svc/Products? $filter=Price gt 1000 | All products with price greater than 1000. |
ge | Greater than or equal | http://localhost:5555/odata/ OData.svc/Products? $filter=Price ge 1000 | All products with price greater than or equal to 1000. |
lt | Less than | http://localhost:5555/odata/ OData.svc/Products? $filter=Price lt 1000 | All products with price less than 1000. |
le | Less than or equal | http://localhost:5555/odata/ OData.svc/Products? $filter=Price le 1000 | All products with price less than or equal to 1000. |
and | Logical and | http://localhost:5555/odata/ OData.svc/Products? $filter=Category eq 'laptop' and Price lt 1000 | All products of category laptop and price less than 1000. |
or | Logical or | http://localhost:5555/odata/ OData.svc/Customers? $filter=City eq 'Paris' or City eq 'London' | All customers from the city of Paris or London. |
Note: | You can also use custom filters instead of OData built-in filters while using the $filter system query option. To use your custom filters, set the Use custom filter property of the OData service to True. You can then specify custom filter queries as the value for the $filter parameter of the _retrieve and _update OData service implementations. |