DEV Community

Cover image for Handling Data in PEGA
Mahith
Mahith

Posted on • Updated on

Handling Data in PEGA

Hey Guys!! I hope you got some basic information about PEGA and it's Technical category from my previous post. Let's move from where I stopped my previous post. As I mentioned this post is all about Data...! 😃

If you haven't read my previous post here's the link to Start your journey with PEGA. I request you to go check it out for basic understanding in PEGA. Moving forward, let's know about the Data Model Category of PEGA.

These are some important things you should know about Data Model Category:

  1. Property
  2. Data Page
  3. Data Transform
  4. Edit Validate rule

Let's see them in detail-

1. Property:

A Property provides a name and characteristics for data. Property is defined in Work class to hold data. It is an instance of a rule-obj-property rule type. There are different property types as shown in the figure below.

Properties in PEGA

Single Value- Select Single value property to create a property that can have a String, Number, Date, Boolean values.

Aggregate properties:

a. Value List- Select Value list property to create a property that can contain an ordered list of single values.

b. Value group- Select Value group property to create a property that can contain an unordered group of single values.

c. Page- Select Page to create a property that can hold an embedded page as its value.

d. Page List- Select Page List to create a property that can hold an ordered list of embedded pages.

e. Page group- Select Page group to create a property that can hold an unordered group of the embedded pages as its value.

BONUS: There are 3 prefixes reserved for standard properties of PEGA namely px, py, and pz. One cannot create new properties with these names and here's what these prefixes mean-

px- Properties with prefix px are Read Only and cannot be overridden or extended by your application. These are generally used to support your application.

py- Properties with prefix py are Read/Write so can be overridden in your application.

pz- Properties with prefix pz are Read Only and cannot be overridden or extended by your application.

2. Data Page:

At times, when we need to access data say Employee details, we need to get data from the database. But accessing it every time we need isn't a good practice so to avoid this performance degradation we use data pages in PEGA.

Data Pages are instances of the Rule-Declare-Pages class. The name of a data page starts with the prefix D_. On the clipboard, the contents of data page instances are visible but are read-only.

Data Page

A Data Page Structure will be a Page or a Page List(contains keyed page access which acts as an index to pages in the Page List)

Scope of data page:

1. Node- If the Scope of a Data Page is specified as Node, it is shared across all the requestors of that node.

2. Requestor- If the Scope of a Data Page is specified as Requestor, it can be accessed by all the threads opened by the requestor.

3. Thread- If the Scope of a Data Page is specified as a Thread, it can be accessed only by that particular thread.

Edit Mode:

Read-only: We can only read data from read-only data pages. Read-only data pages appear in the Data Page list on the clipboard.

Editable: We can edit the contents of an editable data page. Editable data pages appear in the User Page list on the clipboard.

Note: Editable data pages do not have a refresh strategy and can only have Thread or Requestor scope.

Refresh Strategy:

In the Load Management tab, we can specify the Refresh strategy for the data page.

To avoid keeping data pages indefinitely, PEGA periodically checks all Node-scope data pages on the clipboard to find data pages that have not been accessed for that time specified in reload if older than, the page is automatically deleted.

Refresh Stategy

Select the checkbox Reload once per interaction to cause the system to refresh the page exactly once per user interaction. This option is available only for data pages with Page Scope set to Thread or Requestor.

Data Source:

Data pages obtain the data from external sources by connectors, from report definitions that generate queries of the Pega Platform database, or from other sources, and might use data transforms to make the data fully available where it is needed. We can also use simulated data sources.

3. Data Transform:

As Name suggests Data Transform is used for processing and manipulating data. A data transform is used to convert data(source)from one format and class into data(target) of another format and class. We can perform 14 actions using data transform as shown below. We can also implement a data transform inside a data transform. We can also call it in a flow or an activity rule or as a source for Data Page.

Data Transform

4. Edit Validate Rule:

Generally, Validation is for checking whether the input entered by the user is correct and is in accepted form.
Edit validate rules are instances of the Rule-Edit-Validate class.
During the validation process, the value of a property or page is checked against certain rules. If validation fails, a message is added to the page as shown below.

A property may reference an edit validate rule on the Advanced tab. Use the Property-Validate method in an activity to execute the edit validate rule when a value is submitted through a user input form. Edit validate rule is a java code written to perform validation. Also, we can use the OOTB functionalities of PEGA.

BONUS: There are Client-side Validation as well as Server-side validation in PEGA.

In Client-side Validation, Validation depends upon HTML or JavaScript which can easily be handled by the browser. It can be configured in property and control form.

Validation

Whereas in Server-side Validation, Browser sends the request to the server to perform this method of validation. When the form is submitted, server-side validation occurs which involves java code.
So Edit validate contains java code and thus it is a server-side validation. It cannot be performed by the browser, as JVM isn't present at the browser end.

Also, let us see about Report Definition which belongs to Report Category in PEGA.

Report Definition:

The Report definition generates an SQL query to retrieve data from the database table and can generate HTML to display the results. so Basically report definition is to generate reports. Report definition can be referred to in some of the rules like Data Page, Activities, etc.,

BONUS:
There are some topics you must know in your PEGA learning Journey, so here are a few:

What is the Pages&Classes tab present in Report Definition, Data transform & Activities?
-So, if you want to use rules or data present in some other class than rules you are using like Report Definition, Data transform & Activities, etc., you need to specify the page and class from which they can be referred.

What is the Parameters tab present in these rules?
-Speaking in a general programming context, different variables that are passed to the function are called parameters. So, in PEGA there are multiple rule types to which parameters can be passed and received. When we use the parameter based on the value and property it will take at the run time. Parameters are used to reuse the rules during the execution time.

What is a Clipboard?
-Every connected PRPC requestor has an associated temporary memory area on the server known as the clipboard. The clipboard has a hierarchical structure, consisting of nodes known as pages, most of which have a name and an associated class.

The clipboard contains these categories of top-level pages:
a. User pages
b. Data pages, produced by Data Page rules.
c. Linked property pages
d. System pages

That's it for this post guys...! Will meet you soon in my next post, where I'm gonna come up with UI in PEGA. 😎
Stay tuned...!✌
Bubye...🖐 Have a nice Week!

Top comments (3)

Collapse
 
eliowar28 profile image
Eliomar Garzon

thanks for this post bro.

Collapse
 
varaprasad1997 profile image
varaprasad

Hey got small doubt will px and pz can't we override them for sure?

Collapse
 
mahithchigurupati profile image
Mahith

px can be overwritten using a method property-set-special in activity but
pz can't be overwritten.