Using data sources for advanced functions
Invoking a data source using Pre Query
When your application requires custom search, you can write a pre query script on the data source. The platform invokes the pre-query script before performing a search, allowing the developer to control the query being executed to obtain appropriate results.
Invoking a data source in pre-query is mainly used to record an entry before querying for any database object.
E.g.: To know finance related query information, you can invoke a data source to create record entry in an audit table by capturing the user details from the session
When at times, the query gets complex:
Pre-process the query in PL/SQL.
Dump the query results into a temp table.
Create a data source.
To invoke the required table, select the Use API checkbox, while creating the data source.
Inherit the temp table.
Invoke a PL/SQL API based data source using the pre query.
Return an ID from the PL/SQL to the pre query.
Fetch the data and show the results in the UI of the temp table.
Use the code snippet below to invoke the datasource:
The platform maps the inherited result internally into the RPCModelData (a custom cloudIO java class object), which is rendered/read by the component on the UI. Every component works on the RPCModelData object.
Change the parameter values as per your application specifications.
Last updated
Was this helpful?