Tuesday, September 11, 2018

Data Page


#justImagine

Suppose we have created an application for a car dealers for warranty claim.
Imagine dealer has to select the car models and parts to be replaced from drop down.
And we are fetching these details from a DB table. 
Each time the dealer enters a new claim he has to fetch these details from DB.
Just imagine for a car manufacturer there are 1000 dealers and on an avg one dealer is processing 100 claims daily then total 1000 * 100 times DB interaction.
Ideally the car models and the parts for that model is not an entity which will change very frequently.
So we basically need some page/pagelist to hold these data on Clipboard, can be reused and should not be refreshed very frequently to avoid DB interaction
This is the scenario where Datapage is the best fit to serve the purpose

Because -----
Data pages, provide on-demand access to data
MOST IMP
When the system references a data page, the data page either creates an instance of itself on the clipboard and loads the required data in it for the system to use, or responds to the reference with an existing instance of itself.
IMAGINATION END … :P 

#LetsMove

Definition

Structure    
Page – Create a data page containing a single object
List – Create a list-type data page containing a multiple objects
Object type
Class of the Datapage .
Edit mode
Read Only- Once the datapage is loaded it will prevent to modify the data
Editable  - Allow the Data Page to be modified
n  If the data page is Editable mode then it will create under User Pages on Clipboard
n  If its readonly it created under Data Pages on Clipboard
Scope

Thread –
If a Declare Pages instance is defined as a Thread page scope, it is loaded and maintained in each thread that references this page name. If a requestor has multiple threads, then each thread has its own instance of this page.
Requestor –
All threads for the current requestor can access the data page.
Data Page is shared across all of the threads for that requestor.

Node –
 Any requestor executing on the current node can access the pages.
Data Page is shared across all of the requestors for that node.

** There is no option to create a Datapage Scope as NODE if it’s an editable one.
Editable pages do not have a refresh strategy and can only have a Thread or Requestor scope.


Data sources
Prior to 7 for Datapage (formerly known as Declare page) the only option to load data was using activity
But in PEGA 7 other than activity we have options like Report Definition (Only for List type of DataPage), Connector , Data Transform, Lookup (Only for Page type of DataPage) to load the data .
One more beauty is to select multiple Data Source based on when condition.

Data Transform/Activity-
If the Date Page is of List type then the Data Transform/Activity should be of the class Code-Pega-List
And if it’s a page type then Data Transform/Activity should be on the object type class of Data Page (Inheritance path)
Report definition –
Only applicable for List type of data page . The report definition can be of any class
However if the Report Definition class does not match or inherit from the object type of the data page Response Data Transform is mandatory
Connector --
We have a wide range of connector to load the data in Data page .
if the data source is connector then Request Data Transform, Response Page List and Endpoint URL is optional , However the Response Data Transform is mandatory
Lookup –
This is used only for the Data Page having page structure.
If the Applies To key part of the data source does not match or inherit from the object type of the data page.

n  Simulate data source
When this check box is selected we can select an alternative data source to use during development: a Report Definition, a Data Transform, or a Lookup.
Post load processing
Use Data Transform if the data needs to be modified after it loads.
Key page Access

KEYED PAGE ACCESS is a feature which allows the user to retrieve the results faster.

ü  This feature is supported only for LIST structure READONLY Data Pages
ü  On definition tab check the Access pages with user defined keys to implement this feature.
ü  The user can retrieve the results based on single key or by defining multiple keys.
ü  If multiple keys are defined, then the results retrieved/returned is an AND operation of all the keys defined.

Note:
The key value applied is case sensitive.
This feature is supported only for LIST structure READONLY Data Pages

Allow multiple pages per key --
Check this checkbox, if the keys are not unique on the list of data (duplicate rows for the same key), the user can retrieve multiple rows/pages for key(s).

How to use/invoke this KEYED PAGE ACCESS Data Page: --

This can be invoked/referred only through autopopulate properties
The data page retrieves all the records, the keys are applied only through auto populate property.

Let’s consider the following simple example  

Here is one simple data source

 And in Data Page Keyed page access is enabled 
That means Data Page can be accessed using user defined keys .Refer the below screenshot

Suppose we have a page list UserSkill  which is under pyWorkPage and referring to this Data Page
This page is used in a repeating grid.
Now let’s see how key page access works.
1. user portal
2. clipboard
In the above screen shot D_testList contains all the 5 results
However the UserSkill page list contains only those results with matching skill “pega”


Load Management
Clear Data Page Button
Use this button to remove the Data Page from clipboard.
Load authorization
Access Group –
This option is only for Node type of Data Page
Why not for Thread and Requestor?
Because, for Thread and Requestor scope , Data Page can use the access group of requestor who is using  the Data Page .
Refresh strategy





n  Applicable only for readonly Data Page

We have to specify the time to reload the fresh data into the Data Page .
However for Thread and Requestor scope we have few more options like :-
Reload once per interaction-
If the check box is checked Data Page loads exactly once per user interaction. The system ignores any values in the Reload if older than and Do not reload when fields at run time .
Page limits

Limit to a single data page -
This option is only visible if some parameters are defined on Data Page . More on Parameter Data Page.
Clear pages after non-use -
For data pages with a scope of Requestor or Node, select the Clear pages after non-use check box to force the system to delete the clipboard instances of the data page after an interval passes with no access. Subsequent attempts by a requestor to access the data pages cause the pages to reload.
When selected, this setting has different effects depending on the scope of the data page:
  • Requestor scope – The data page instance that is created when any thread refers to the data page is removed when there are no more threads referring to it.
  • Node scope – The system checks the Reload if older than fields on the Load Managementtab of the data page rule. If the fields are blank, the system uses the value of the Dynamic System Setting DeclarePages/DefaultIdleTimeSeconds, which is set by default to 86400 seconds, or one day.
Parameters
This tab defines the parameter, the Data Page uses for its Data Source
Just say I defined 1 param called Param1 on Data Page
Just say Param1 is for Skill . The parameter I have passed to Report Definition to get the Skill Details.
Find the below screenshots
Whenever the Data Page is referred we have to pass the param .

Pass the Param to Report Definition


Run the Data Paga passing Param as “pega”

Run it again with Param as “java “


For each param the data page will load accordingly on clipboard

But when Limit to a single data page check box is checked, then for each new param it will replace the existing one.

How to use parameterized Data Page in Activity/Data Transform ?



Usage Tab

This tab displays rules that are currently using the data page


-- Kindly let me know if I missed something . Thank you :) 

2 comments:

  1. Hi Rakesh,

    I have a doubt here that can you explain little idea about test cases and specifications tabs in data page??

    ReplyDelete

Featured post

Queue Processor

  Overview Starting with Pega Platform version 8.1, Job Scheduler and Queue Processor rules replace Agents and improve background processi...

Popular Posts