Setting the context of a data page
A single data page can create many instances of itself and tailor each instance to the context in which you are using it in the application. This process simplifies creation and maintenance of your code, since one data page can serve multiple references.
The following figure shows a sample list of products on a page, from which you can select products and add them to your shopping cart:
You have a preferred provider (for example, Northwind), but you do not want to select from Northwind's products. Instead, you can use a more general Google search to get a list of products from another provider.
You can then use a single data page with multiple possible data sources to deliver both providers' product lists. Depending on the designated parameters, including which provider to use, the data page creates a tailored instance of itself on the clipboard, which only includes the data about the products that the selected providers offer.
The following figure shows the Definition tab of the data page, which lists the possible data sources for instances of the data page:
If the reference specifies the Northwind product list, in which case the when condition
NorthwindSearchProviderSelected evaluates as true, then the data page requests data from the NorthwindProductList data source and creates an instance of itself on the clipboard with the data returned from that source. Depending on the data page's refresh strategy, the data page might use an existing instance of itself on the previously created clipboard by using the same parameters and conditions.
The following figure shows an instance of the data page on the clipboard that was created to respond to the reference:
The following figure shows the properties and values that are sent with the pxDPParameters page reference, which permit tailoring of the data page instance:
In a subsequent search, you perform a product search using the Google option and the reference for the search goes to the same data page as the reference for the initial search. The reference uses the parameters that are sent to evaluate the when condition
NorthwindSearchProviderSelected to false. The data page then uses the other data source option to create an instance of itself on the clipboard, or to locate an existing instance that matches the parameter values of the reference and the refresh conditions of the data page. In addition, the data page provides data that matches the parameters that are sent with the reference in the same instance.
Management of data page instances
Pega Platform maintains three page scope levels: node, thread, and requestor. Each of these levels has a data page container; and each container has soft and hard limits for the number of pages that it can contain. For example, for the Thread and Request levels the soft limit is 60% of the Base Limit and the hard limit is 125% of the Base Limit, while for the Node level the soft limit is 80% of the Base Limit and the hard limit is 120% of the Base Limit. In short, the limits for both Thread and Requestor scope levels are 600 to 1,250 instances, while the limits for the Node scope level are 800 to 1,200 instances. The default value of the Base Limit of any of these containers is 1,000. When the number of page instances exceeds the set limit, the system deletes all data page instances that were last accessed more than ten minutes earlier.
After deleting the data page instances, if the number of instances of the data page still exceeds the set limit, the system tolerates an overload of up to 1,250 instances for the Thread and Request levels, and 1,200 for the Node scope level. If the number exceeds that limit, the system deletes instances, regardless of when they were last accessed, until the number of entries in the cache is below the set limit.
The data page creates new instances as needed, to respond to references and to replace the deleted instances.