Defining a JavaScript function when sourcing large data pages from a connector, activity, or data transform
To source large data pages from a connector, activity, or data transform, define the JavaScript populator function in a Pega Platform text file.
- In the header of Dev Studio, click .
- On the Create Text File tab, in the Text File
Record Configuration section, configure the text file:
- In the Label field, enter
<datapage-name>_datapage_api.The datapage-name variable corresponds to the data page that you created in Creating a data type when sourcing large data pages from a connector, activity, or data transform.
- In the App Name (Directory) field, enter webwb.
- In the File Type (extension) field, enter js.
- In the Label field, enter
<datapage-name>_datapage_api.
- In the Context section, specify the branch and ruleset for the file.
- Click Create and open.
- On the text file tab, on the Main tab, in the text
field, define the custom populator by entering the following JavaScript
code:
var <function-name> = function(parametersMap, clientStore, onSuccess, onFailure) { var targetDatapageName = "<datapage-name>"; var query = "SELECT <field-name1>, <field-name2>, <field-name3> FROM <datapage-name>"; var queryParameters = []; clientStore.runQuery(query, queryParameters, targetDatapageName, onSuccess, onFailure); } pega.ui.ClientCache.registerLargeDatapage("<datapage-name>", <function-name>);
where:
- function-name is a function name of your choice.
- datapage-name is the name of the data page that you create in Creating a data page when sourcing large data pages from a connector, activity, or data transform.
- field-name1, field-name2, and field-name3 are the names of the fields that you specify in Creating a data type when sourcing large data pages from a connector, activity, or data transform.
To filter the source data page returns or to join data from separate large data pages, further customize the populator function. For more information, see Further customizing data population for large data pages.
To learn more about the structure of the populator function, see Data population for large data pages in offline-enabled mobile apps.
- Click Save.
Previous topic Creating a data page when sourcing large data pages from a connector, activity, or data transform Next topic Further customizing data population for large data pages