Aggregate Source in Data Page – its Configuration, Usage & Execution
Aggregate Source

Aggregate Source in Data Page – its Configuration, Usage & Execution

Summary:

This article describes about a data page source ‘Aggregated Sources’ which is available from PEGA 8.4 version.

Please go through our previous post to understand the configuration & usage of the data page rule in Pega.

Many a time we may need to fetch data from multiple sources and consolidate them before we can use them. For example, online food delivery applications like Swiggy/Zomato connects with multiple data sources to fetch the restaurant details, food – its available quantity & price before loading the information in the application.

What is Aggregated Sources?

  • It is one of the data source option available in the Data Page rule starting from v8.4
  • It can be used to consolidate data from multiple sources and populate them onto a single page which can be readily used by the application.

Why Aggregated Sources?

Let us consider that OSP has a Claims application where list of Customers and list of Prospects/leads are maintained in two different tables and we have a requirement to fetch a consolidated list of all the customers and prospects.

How do we achieve this? 💭

  • We can create a data page sourced with a data transform.
  • Data transform can first call a report definition to get the list of Customers, loop through the list, and append the list to Data Page.pxResults().
  • Data transform can then call another report definition to get the list of Prospects, loop through the list, and append the list to Data Page.pxResults().

Wouldn’t it be easier if Pega itself provides us a way to configure multiple sources within a data page directly instead of using a data transform or activity to call multiple sources? Yes, Pega provides this option in the form of Data Page with Aggregated Sources.

How to configure Aggregated Sources?

  • Aggregated sources is applicable for both List and Page structure data page.
  • The data source option in the data page should be selected as Aggregate Sources .
  • Give a name to the aggregated source and configure sources using Add source option. The system executes the sources in the order they are listed.
  • Source can be selected from anyone of the available sources.
  • It is mandatory to configure Response Data Transform even if Object Type and class of the Source is same.
  • When a data page with aggregate source is executed, it runs the configured sources in the mentioned order and updates the data page with each of its results.

Let’s discuss few business scenarios to understand the real-time usage of the aggregated sources

Business Scenario 1

Let us consider the above-mentioned scenario where OSP has a Claims application with the list of Customers and list of Prospects/leads maintained in two different tables and we have a requirement to fetch a consolidated list of all the customers and prospects.

Implementation

  • Just for POC purpose, Customer and Prospect information are maintained as data type in Pega.
  • Create a data page of type List and select Source as Aggregated Sources.
  • Let us configure an aggregated source referencing 2 report definitions to fetch Customer and Prospect List.
  • Let us also configure Response Data Transform and add them to each source.

Execution

Let us save and run the data page. We can see that the data page runs both the report definitions in the configured order and displays the consolidated results.

Business scenario 2

Let us consider that OSP Claims application has a requirement to display the following details for a particular customer ID:

  • Customer Details like Customer Name and Address for a particular customer ID which is maintained in a data table.
  • Customer’s reward points which are present in an external application called OSP Customer Rewards. OSP Customer Rewards has exposed a REST service that accepts Customer ID as an input and returns the reward points of the customer as a response.
  • Based on the reward points, the Customer needs to be classified as Silver, Gold, or Platinum. Customer Type should also be displayed along with Customer Reward Points.

Implementation

  • Create a data page with Page Structure with Customer ID as a parameter to the Data Page.
  • Let us select the source as Aggregated Sources and give an Aggregate Source Name.
  • The first requirement is to get all the Customer Data from a table. We can use a look-up and pass the Customer ID so that we get all the Customer Data maintained for a particular Customer ID as part of the data base table. We need to configure Response Data Transform for an aggregated source data page even when Object Type and source class are the same.
  • The second requirement is to get the Customer Reward point by invoking a Connector exposed as part of OSP Rewards application. Let us click on +Add Source to add the next source. We can use a Connector as source to satisfy this requirement. Customer ID is passed as the request using Request Data Transform and Customer Reward Points obtained as response is mapped using Response Data Transform.
  • The third requirement is to classify the customer as Silver, Gold or Platinum based on the Reward Points obtained from external system. To incorporate this, let us add another source and invoke a data transform. This Data Transform will call a decision table which returns Customer Type based on the Customer Reward Points that is obtained as response.
  • Now we just have one data page with aggregated sources (Lookup + Connector + Data Transform) that populates all the required information in one hit.

Execution

Let us run the Data Page by passing Customer ID PCX001 as the parameter and observe the results.

We got all the desired values in a single data page. 😊

Advantages of Aggregated Source

In real time scenario, if there is a need to consolidate data from multiple Connect REST sources, this option will be really helpful. Without this option, we will need to write an activity to call multiple Connect REST and consolidate the results.

Pointers to Remember

  • Aggregated Sources is available as a Data Page source option from Pega version 8.4 and above.
  • It can be used with both List and Page structure.
  • It can be used to consolidate data from multiple sources and populate them onto a single reference page.
  • Sources get executed in the order they are configured.
  • It is mandatory to configure Response Data Transform even if the Object Type and a class of the Source are the same.
  • We can use multiple combinations of Aggregated Source within a single data page using the If and Otherwise capability provided by the Data Page.

We are now at the end of the post. We hope you got the understanding of when and how to use Aggregated Sources as a Data Page source.

We are glad to publish the article requested by @ Aditya Kunal on “Configuring Aggregated Sources in Data Page”. If you want us to publish any articles of your choice, please fill out this form & we will make sure it gets published.

OSP TEAM
Written by
OSP Editorial Team

Recent Jobs from our community

loading
View more Jobs on OSP Forum
Join the discussion

Feel free to post your questions here about this topic if any. We will definitely get back to you ASAP !!!
If you have any off-topic questions, Let's discuss at OSP Forum

35 comments