B2B Integration 10.4 | Administering and Monitoring B2B Transactions | Service Development Help | Working with OData Services | Querying Data Using $filter
 
Querying Data Using $filter
You can use filter expressions in OData requests to filter and return only those results that match the expressions specified. You do this by adding the $filter system query option to the end of the OData request.
You can specify the $filter query option in an OData request as follows:
http://host:port/odata/parent_context/resource?$filter=expressions
Here, parent_context is the OData service node in the Integration Server namespace, resource refers to the name of an entity type or a collection of instances of an entity type, and expressions are the filter expressions.
Integration Server supports the following logical operators:
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.

Copyright © 2016- 2019 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.
Innovation Release