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:

  1. Pre-process the query in PL/SQL.

  2. Dump the query results into a temp table.

  3. Create a data source.

    1. To invoke the required table, select the Use API checkbox, while creating the data source.

    2. Inherit the temp table.

  4. Invoke a PL/SQL API based data source using the pre query.

  5. Return an ID from the PL/SQL to the pre query.

  6. Fetch the data and show the results in the UI of the temp table.

  7. Use the code snippet below to invoke the datasource:

circle-info

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