Modeling a Query
Use
You model a query that you have created by defining the input and output parameters, adding joins, filters, and sorting criteria, depending on your requirements.
Prerequisites
You have created a query.
More information: Creating a Service
If your output structure is not equivalent to a client data object node (for example, because you are performing a join on client data object nodes), you need to create a data structure containing those fields that you require in the output structure.
More information: Creating Data Structures
Procedure
-
In the Service editor, select the service you want to model and choose Edit .
-
Select tab page Operations and choose Add to add a new service operation.
-
In the next dialog box, select Query , enter a Name (mandatory) and a Description (recommended) for the query operation, and choose Next .
-
Select the input parameters under Add Input (optional).
-
In the Base Types dialog box, Add the name of the parameter.
-
Enter the type of the parameter.
-
Select Bidirectional or Distinct if necessary.
More information: Query language Reference
-
Continue with this step, until you have defined all the input parameters you need for your query.
-
-
Select the output parameters under Add Output (mandatory), choose a client data object node or data structure in the list as the return structure of your query.
The query will return a collection of this type.
You can also use drag and drop from the data types area to the left of the dialog box to select the output structure.
-
Add any joins you require under Add Joins (optional).
-
Add any filters you require under Add Filters (optional).
By default, any new filter is combined with the existing filters through an AND condition. By clicking on AND , you can change the condition to OR and back to AND.
-
Add any sorting conditions you require under add Sorting .
Sort criteria on any attribute of the output structure can be set as either ascending or descending.
More information: Query language Reference