Showing posts with label Data Page. Show all posts
Showing posts with label Data Page. Show all posts

Saturday, May 25, 2024

Function for Deleting Declare Pages in Pega

Managing declare pages in Pega is crucial for ensuring optimal performance and maintaining data integrity. Sometimes, you may need to delete all instances of a declarative page, especially during troubleshooting or system maintenance. Pega provides an out-of-the-box (OOTB) function to achieve this efficiently. In this blog post, we will explore how to delete all declare pages using the pzDeleteAllInstancesOfDeclarativePage function in Pega.

The Function to Delete Declare Pages

The function @(Pega-RULES:DeclarePages).pzDeleteAllInstancesOfDeclarativePage(tools, DataPageName) allows you to delete all instances of a specified declarative page. This function is powerful and should be used with caution to avoid unintended data loss.

Parameters:

  • tools: The standard tools parameter used in activities.
  • DataPageName: The name of the declarative data page you want to delete.

Example

Suppose we have a declarative page named D_CustomerData. To delete all instances of this declarative page, the function call in the Data Transform will look like this:

  • Function: @(Pega-RULES:DeclarePages).pzDeleteAllInstancesOfDeclarativePage(tools, "D_CustomerData")

Conclusion

Deleting all instances of a declarative page can be a powerful tool for managing your Pega application's data. By using the pzDeleteAllInstancesOfDeclarativePage function, you can easily perform this task within a Data Transform. Remember to use this function judiciously to avoid unintended data loss.

Happy Pega development! 😁


Further Reading

Sunday, September 16, 2018

Difference between Refer to a data page and Copy data from a data page


  Where to find this option
  Properties like Page or PageList have an option for this Data Access option

  Find the below screen shot 





  Here we have 3 options
n  Manual
n  Refer to a data page
n  Copy data from a data page

  Manual –
   For Manual Data Access user has to set data manually.

  Now let’s see the rest 2 Data Access options.

  In other 2 options we need a data page.

  To check the difference these lets go through a small example.

  Here I am using the below data set

  To demonstrate the same I have used 2 page list with the same Data Page
  One is for Refer and other is for Copy
  D_testList is my DataPage which have used in both the case  

   It has having the parameter as Skill 



I have used both the page list in a repeating grid.
Let’s create a work object and see what happens


Same data in both the grid .
But what is the diff?
Now save the work object and close.
Now add one more row on the data set we are using

Now open the work object
See the diff
So in case of copy the repeating grid is showing the old data but in case of Refer the new record is updated 


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


You can refer to a data page with one of several valid forms of this syntax. For D_Customer, you could load or refer to the data page using any of these:
Here CustomerID and CompanyName are 2 params of D_Customer
Using hardcoded value, Property or Param --
  • D_Customer[CustomerID:“ANTON”,CompanyName:"BigCo"]
  • D_Customer[CustomerID:.CustID,CompanyName:Param.CompName]
  • D_Customer[CustomerID:Param.CustID, CompanyName:"BigCo"]
When the data page only has one parameter, you don't have to specify the parameter name. You only need to specify the value:
  • D_Customer[“ANTON”]
  • D_Customer[.CustID]
  • D_Customer[param.CustID]
Ex-
Suppose D_Customer is of page type
Suppose we want CustomerID property to be used on Activity / Data Transform
  • Then we can use D_Customer[CustomerID:“ANTON”,CompanyName:"BigCo"].CustomerID




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 :) 

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