White Papers
Abstract
A query option is a set of query string parameters applied to a resource that can help control the amount of data being returned for the resource in the URL. It is is basically requesting that a service perform a set of transformations such as filtering, sorting, etc. to its data before returning the results.
Content
| SAP OData Query | Functions |
|---|---|
| TOP |
The option requests the number of items to be included in result. |
| SKIP | The option skips the first N number of items in the query and are not included in result |
| FILTER | The Query option filters collection of resources. The expression given in filter query is evaluated for each resource in collection |
| ORDERBY | The Query request resource to be retrieved either in ascending or descending order based on the given expression. |
| SELECT | The Query retrieves only the given columns in the expression along with the key columns. |
| SKIPTOKEN | The Query enables efficient server-side paging of query results when the size of the data set is too large to be retrieved in a single request. |
For a new Datastage flow-
- Drag Asset Browser to create a new Datastage flow.
- Select the connection for SAP OData.
- Select the Service Name
- Select Entity Set and click on Add.
A job would be created with the input properties given by you.
- Double click the connector to open properties.
- In the stage property, there will be Query Options property.

- You need to give value in this property for implementing Query Options in the SAP OData connector.
For an existing job
- Select the Datastage flow to be modified.
- The job will open, double click the connector to open the palette.
- In the stage property, there will be Query Options property.
- You need to give value in this property to implement Query Options in the SAP OData connector.
Format to give query expression in Query Options property:
- Simple Query – A query with single query options applied.
- filter=Property_Name eq ‘XYZ’
- select=Name
- filter=CreationDate eq datetime'2023-05-04T00:00:00'
- orderby=PurchaseOrder [desc|asc]
- skiptoken=800
- Complex Query – A query with combination of two or more Query Options with same or different type.
- filter=Name eq ‘John’ and Currency=’USD’
- filter=startswith(PurchaseOrder,’4’) eq true & orderby=Name
- filter=Currency eq ‘USD’ & orderby= Name desc & skiptoken=500
Note – The select query should always contain key properties along with any other properties that you might include.
For example, if an entity set A_PurchaseOrder has PurchaseOrder as its key property then select query must include PurchaseOrder.
Example: select=PurchaseOrder, PurchaseOrderType, Currency.
If you give select=Currency, Address, the job will fail as PurchaseOrder is not given in select query which is the key property of the entity set.




Was this topic helpful?
Document Information
Modified date:
17 April 2024
UID
ibm17147776