Further customizing data population for large data pages
Decide how you want to process the data that you fetch from large data pages by customizing the populator function. For example, you can join data from two separate data pages.
By customizing the populator function, you can perform the following operations on the data that the client store forwards to the client cache:
- Filter the content of the large data page.
For example, in an expense reporting app, you can configure a drop-down list to display only employees that report to a specific manager.
- Join data from two separate large data pages.
For example, you can add personal employee data to expense reports by joining the data page that contains expense reports details with the data page that contains employee data.
- Further process the data that the populator returns according to your needs.
- Define the populator function as follows:
var <function-name> = function(parametersMap, clientStore, onSuccess, onFailure) { var targetDatapageName = "<target-datapage-name>"; var query = "<sql-query>"; var queryParameters = [<properties-array>]; clientStore.runQuery(query, queryParameters, targetDatapageName, onSuccess, onFailure); } pega.ui.ClientCache.registerLargeDatapage("<target-datapage-name>", <function-name>, [<source-datapages-list>]);
where:
- function-name is a function name of your choice.
- target-datapage-name is the name of the target data
page in the client cache.
By specifying the name of the target data page, you ensure that the
runQuery
function returns the requested properties in a format that the client cache accepts. - sql-query is the SQL operation that the function
performs on the source data page.
For example, for a drop-down list to display only the employees that report to a selected manager, define the
query
parameter by using the following SQL query:var query = "SELECT * FROM D_Employees WHERE pyManager = ?"
. - properties-array is an array of SQL parameter values
in the order of their appearance in the query.
For example, for a drop-down list to display only the employees that report to a specific manager, define the
queryParameters
parameter as follows:var queryParameters = [parametersMap.pyManager]
. - source-datapages-list is an array of source data pages from which the target data page fetches the results.
For more information about the structure of populator functions, see Data population for large data pages in offline-enabled mobile apps.
Previous topic Defining a JavaScript function when sourcing large data pages from a connector, activity, or data transform Next topic Data population for large data pages in offline-enabled mobile apps