Using Named Queries with the JSDO Generic Service
The Generic Service Interface for the JSDO does support now the usage of Named Queries. Named queries simplify the the definition of complex queries with potentially a number of parameters on the backend - rather than having the client to provide a valid query.
Note, the usage of named queries is not intended to work with the filter capabilities of the Kendo UI grid and the Kendo UI data source - as those components produce an ABL query string on the client.
Support for named queries is intended to be used with the JSDO fill method: https://documentation.progress.com/output/pdo/#page/pdo/fill(-)-method.html#wwconnect_header
The parameter object passed to the fill method will be serialized to JSON an send to the backend. When the JSON string contains the "NamedQuery" (casing is ignored) the named query will be deserialized to an NamedQueryParameter instance which is part of the FetchDataRequest object send to the Business Entity FetchData method like the following:
Creates a NamedQuery with two parameters
{ "NamedQuery": { "name": "DateRange", "parameters": [ { "name": "DateFrom", "type": "date", "value": "2016/1/1" }, { "name": "DateTo", "type": "date", "value": "2016/12/31" } ] } }
Creates a NamedQuery with no parameters
{ "NamedQuery": "OrdersOfToday" }
Supported values for "type"
- character
- date
- datetime
- datetime-tz
- decimal
- int64
- integer
- logical
- object (in this case, we can reference the json object in the value property here).