Pages

Thursday 8 March 2018

Fetching multiple records using PEGA PRPC

How to Fetch Multiple Records/Objects?



In old PEGA versions like PEGA 6 we used Dynamic Select.
It was replaced by Data Page concept in PEGA 7+.
Data Page: Load the data from Data class and reuse it from different FLOWs
Dynamic Select: We need to add manually every time

Data Page can applicable for select box/dropdown/autocomplete/radio.
Data pages can be created under Data Classes, which you can find in Application Explorer.

Fetching Multiple Records for single property:
To Do :
Need to create Data Page under Data Classes > Data Model > Data Page
Need to create Activity in Data Classe.

After creating Data Page you need to add the same to dropdown property in section.

Data Page: All data pages are starts with prefix “D_“
Data Class > Data Model > Data Page > give label and click ok
Structure:  As said we can use Data Page in other pages as well, if you want to restrict it to the same page then we need to choose structure as “page”, if you want to allow then you can use List.

Structure: Page (if you want to restrict access to the same page and you want to load only one property values at a time then you can use this)
List(if you want to grant access to every page and also want to load values of all properties then you will go for this)
In the data source you need to give activity name after creating the activity for this Data page.

You need to create a activity to load the Data Page.
Note: You no need to give the Pages and Classes concept in activity while fetching using Data Page because we are simply calling the data page from activity we can directly check the values in the Data Page.

Step1: use Object-browse method for multiple objects fetching. No need to give the values in step page.
            In the parameters, you need to provide data page name and Data class name. In the select field you need to map the property name. (you need to put . in the box to show the values)

After activity creation, you need to add this activity name in the data source.

If you want to see whether the Data page is loaded or not you can see values by clicking the run option from the data page.
If you want to show the values on the UI then you need to configure the data page in the property configuration under List Source you need to choose Type as Data Page.

Since you can load multiple properties values you need to map the particular property name in the “property for value” option.

Fetching the Multiple Records/Objects for the multiple properties:
Create a Data Page in Data class.
We need to use structure as “List” this time.
Whenever you select List as structure then you need to write configure inside “code-pega-list” class.

Note: Activity will be configured in Data class if the Data Page structure is set to “Page”
Activity will be configured in “code-pega-List” class if the Data Page structure is set to “List”

In the rest of the scenarios, you configure Activity in Work class only.