Press "Enter" to skip to content

Aggregate properties and use of Indexes inside aggregate properties in Pega

49

Introduction

In this post, we will see about aggregate properties and its usage. We will also discuss about various Indexes (<CURRENT>, <APPEND> etc..) that can be used inside  aggregate properties.

  •  Properties help in storing the data. Data can be simple single value or can be grouped and stored in pages.
  • Aggregate properties helps in grouping the data.

Say for example – Policy Name, Policy Date, Policy period, Expiration date all these single value properties are related to Policy right. Here we can store all these values under a page property called Policy.

Now if multiple policies are applicable, then we can save multiple policy pages under an aggregate property.

In this scenario – you can form a page list / Page group.

Aggregate properties

  1. Value list – This type is kind of single value property, but can contain more than one values. The values are arranged in an ordered array.
  2. Value group – This is same like value list property, but the values are arranged in an un-ordered array.
  3. Page – This type can contain more than one single value property and its value embedded inside.
  4. Page list – This type is a collection of Pages in an ordered array
  5. Page group – This type is a collection in pages in an un-ordered array.

What is Value list property type?

  • Every single value property contains a single value. Agree 🙂
  • I am saying some single value properties can contain multiple values!!   …………Confused !!

The best example is phone number

Phone numbers can be – Home number, office phone, mobile phone but they are all phone numbers

Now Instead of creating 3 properties

  1. HomePhone
  2. OfficePhone
  3. MobilePhone

You can create a single value list  property to hold all the values 🙂

PhoneNumber – Value List property.

Let’s go ahead and create a new value list property.

  • Now a PhoneNumber value list property is created.

How do we use a value list property in activity / data transform?

Step 1: Create a test activity.

Step 2: Add a property-set and try setting a value like, how we do for single value property and save the activity.

You get an error – Cannot set a String to a string list property.

  • This is because this is a specialized single value property type that contain a list of values.

So, when you hear list, what comes in your mind – array.

  • Aggregate properties can be compared to array objects in Java.

Step 3: Let’s save the value in array list 🙂

I am able to save it.

Step 4: Run the activity and check the clipboard for ActivePage.

Why no value set on page?!!

Cool, generally for aggregate values, you need to expand the ActivePage.( Embedded)

  • You can set more than one values inside the PhoneNumber property

  • Check the clipboard.

Now let’s check how to use the values inside an activity loop.

  • You can loop the value list property. Click on the loop

Repeat – For each element in value list ; Value List property – PhoneNumber

This will be like

For ( i=1; i >=(Max length); i++)                                 ( Note: Max length is 3 here)

{

}

Note: You can also do the same  property-set in 3.0 step

  • <CURRENT> will be auto populated with ‘i’ value. It means in First loop, it will refer = 1
  • So, in first loop, PhoneNumber (<CURRENT>) = .PhoneNumber(1).

Trace open the rule and run the activity.

Let’s check the param value in each loop.

Note: Param.pyForEachCount will contain the Loop Index ( ‘i’ value)

You can also bring the (<CURRENT>) to left hand side of a property-set to update/ set the values in valuelist property.

What are the  Indexes you can use inside an aggregate property?

  1. <APPEND> Index
  2. <LAST> Index
  3. <INSERT> Index
  4. <PREPEND> Index
  5. <CURRENT> Index

<APPEND> Index

  • This index is used, when we need to append an element to the highest index value.
  • This is used only in target properties – It means properties on left in property-set method.
  • This is applicable for value list and page list properties

I can set all three Phone Number values using <APPEND>.

  • Instead of hard coding, you need to do like this 🙂

Run the activity and check in the clipboard.

Good 🙂

  • Say if there are already 2 phone number values in PhoneNumber valuelist property ( PhoneNumber(1) & PhoneNumber(2))
  • Then appending will add PhoneNumber(3)

<LAST> Index

  • This index is used to retrieve the last element in value list/ value group property.
  • <LAST> will be replaced with the Highest subscript or index
  • This is applicable for value list and page list properties

We have populated three phone number values using APPEND.

Now let’s use LAST

Step 1: Add a new step and update the last Phone Number with ‘1111111111’

Step 2: Run the activity and check in the clipboard.

In the Page list example, you will get to know more about it 😊

<INSERT> Index

  • This index is used to insert a new element and its value in a value list / page list property at a specific numeric position
  • This is similar to APPEND Index and used only in target properties.
  • This is applicable for value list and page list properties

Note: Unlike other Index, here you need to specify the subscript value, where you will be inserting

(<INSERT>1) – It can 1, 2 or 3 (subscript value)

The Difference between <APPEND> and <INSERT> are

  • <APPEND> always appends a new element to the highest index value (Last), where <INSERT> Can append/Insert to any index value.

In the above example, I have 3 phone number values. IF I need to insert a new phone number to position 1 – PhoneNumber(1), then all the other values are pushed down by One position.

Let’s test it.

Step 1: Add a new step and Insert the Index.

Step 2: Run the activity and check the clipboard.

We have successfully inserted a new element in position 1 and all remaining values are pushed one position down the array.

<PREPEND> Index

  • This index is used, when we need append an element to the first Index.
  • This is the exact opposite of APPEND Index.
  • This is applicable for value list and page list properties

In the above example, we inserted Phone number = “1111111111” in the first position.

We can achieve the same <PREPEND> index.

Step 1: Add a new step with <PREPEND> index.

Step 2: Run the activity and check in the clipboard.

<CURRENT> Index

  • This index is used, when we are inside a loop and want to update the properties in the current loop. We already tested 🙂
  • Current in used in all types of aggregate properties. You can use it in a page list, page group, value list or value group.

Let’s get back to our property type discussion😊

What is Value group property type?

This is same as Value list with the exception that the values are unordered. (not ordered in 1,2,3 etc)

The perfect example can be email address. You can have two email address.

  1. Personal
  2. Official

Instead of creating 2 properties, we can create a single value group property – EmailAddress

Property type – ValueGroup

 How to use a value group property in an activity/data transform?

Step 1: use the same test activity

Step 2: Add a property-set.

Instead of ordered number, you can update it with some text value – Unordered list

In the Email address example, you can update EmailAddress(Personal), EmailAddress(Office)

Step 3: Run the activity and check in the clipboard.

You can trace open the rule and check the parameters inside the loop.

Note: pzForEachSubscript will contain the value group subscript value

What are the differences between value list & value group?

  • Value list contain ordered list of single values, while value group contain un-ordered list of values.
  • You can use the five types of Indexes inside a value list property, since the subscript( index – 1,2 etc) value can replaced by the Index, but in Value group you can only use (<CURRENT>).

We have an advantage on value group over value list.

  • Say, for example you created the same EmailAddress property using value list.
  • Now, you cannot identify which subscript contains the personal email address. It can be either 1 or 2 right? EmailAddress(1) or EmailAddress(2)
  • In this scenario, you can make it value group and refer personal email address directly using EmailAddres(Personal) everywhere 😊

Let’s test using value group inside a loop

Step 1: Create a test activity

Step 2: populate the EmailAddress value group property with personal and Office email address.

Step 3: Start a loop and  use

Repeat – For each element in value group; Value group property –  Email address.

Step 4: Trace open the rule and run the activity.

  • Open the parameters on each page and check the Test value. You will see email addresses set correctly 😊

What is Page property type?

  • We know that pega stores all the data in the form of clipboard page in memory.
  • Pages contain data.

The pages we create in activities or data transform are user defined pages and wipes out once the memory is cleared from JVM ( like you log out).

In some scenario, you need to save some collection of data within the work item.

The best example is address details.

  • You need to collect all those details and append to work item ( No need to expose)
  • Here you can create a new property – Address – Page type

Store all the single value properties ( City, state, Zipcode) under the Address – page property

Create a new property – Address and update property type – Single page

Page definition –

What is page definition ?

Remember, whenever we create a new page in activity, we will be specify the page name in pages & class.

  • Every page will contain a page definition class – pxObjclass.
  • For a page property, we no need to  specify in the pages & classes tab 😀

So you specify here.

Important points to remember in Page definition configuration

  • You can specify any concrete class here. In the above example, I used a concrete class – TVS-Data-Address, so that properties under the address data class ( City, State, Zipcode) can be included inside the Address page.
  • If you specify any abstract class, at run time a concrete class can be dynamically referred.

You may see this as kind of reusing – dynamic referencing

  • You can also use $CLASS or $ANY for dynamic referencing

To check, you can open the pagelist property ‘pxResults’ and check the  page definition.

  • You know that pxResults will be used in many places to contain the results pages ( obj-browse) – Either work or data any class.
  • So we specify $CLASS and dynamically refer the class of the in activity / Data transform rule.

How to use page property in a data transform / activity rule?

Step 1: Create a new test activity

Step 2: Update the Address page with address values.

  • You don’t want to specify the step page ‘ActivePage.Address’ in the pages & class, Since the page definition in the property rule form contains the appropriate class definition

Note: If you use $CLASS or $ANY, you need to specify the class in pages & classes tab.

Step 3: Run the activity and check the clipboard.

  • You will see the address page populated with all the values.

Note: Page property can also include properties other than single value. You can embed another page, page list, page group, value list or value group inside a page property.

 What is Page list property type?

Value list – Collection of single value properties in an ordered list

Page list – Collection of pages in an ordered list

For example – say, you need to store the office address details and residential address details separately in pages.

Here you can create a page list property – AddressList and store both the address details.

AddressList(1) – Office Address

Addresslist(2) – Residential address

Create a new page list property – AddressList

For testing – save as the rule to create another pagelist property – NewAddressList 😊

Step 1: create a new test activity.

Step 2: Populate the address details in AddressList pagelist property.

  • You can either user <INSERT> or can just harcode it.
  • Now, let’s see how to populate NewAddressList inside loop

Note: Whenever you are inside a loop, Param.pyForEachCount will contain the subscript value

Step 3: Add a new step with step page – ActivePage.AddressList

Repeat – For each embedded page

Only loop for certain classes – Remember, you can specify the page definition – $ANY and can be dynamically substituted for each page inside page list. So a page list can contain pages with multiple classes.

  • You can conditionally loop the pages only for certain classes 😊

Maximum, we leave this empty and loop all pages.

You can do page-copy to copy the loop page inside a destination page.

You can use the (<CURRENT>) Index to copy the AddressList to NewAddressList

Step 3: Run the activity and check the clipboard.

Step 4: Let’s try property-set instead of page-copy

We do this, when we need to copy only few properties ( City, State) not the whole page.

  • You will see two Indexes used – <APPEND> followed by <LAST>

The reason is as follows

  1. APPEND will append a new page , say .NewAddressList(1)
  2. In the next step, we need to add few more properties in the NewAddressList page right 😊

So, we use <LAST> to get the last subscript value – Obviously  1 in this case.

Both APPEND and LAST are substituted with subscript value ‘1’

Step 5: Run the activity and check in the clipboard.

You will see city and state are alone copied

What is Page group property type?

  • Collection of pages in un-ordered list.

Like the same we discussed about value group

  • Here the AddressList, I can configure it to PageGroup property type and set the value to

AddressList(Office) & AddressList(Residential)

Create another new page group property – NewAddressList for testing purpose

Let’ test using same activity.

Step 1: Populate the page group property – AddressList

Remember, we can use

Note: Like Param.pyForEachCount, pxSubscript will hold the subscript value.

Step 2: Create a new step looping the AddressList pagelist property.

Repeat – For each embedded page

Step 3: you can make use of the pxSubscript property to substitute the index dynamically.

Step 4: Open the tracer and run the activity.

You can see the pxSubscript will contain Office and Residential inside each loop.

Step 5: Now check the clipboard, if all the values are populated in NewAddresList property.

What are the difference between Page list and page group properties?

The differences may look similar to the difference between value list and value group types.

  • Page list contain ordered collection of pages, while Page group contain un-ordered collection of pages.
  • You can use all the five types of Indexes inside a Page list property, since the subscript( index – 1,2 etc) value can replaced by the Index, but in Page group you can only use (<CURRENT>).
  • Page list – Param.pyForEachCount will contain the subscript value inside loop. Page group – .pxSubscript will contain the subscript value inside loop

Hope you are clear with the aggregate properties and different indexes you can use inside 😊

 

  1. Sathish Sathish

    Excellent..

    • Premkumar G Premkumar G

      Thank you, Sathish. 🙂

  2. Chhatrapal Singh Chhatrapal Singh

    Hi Premkumar,

    Thanks for this article. I eagerly wait for your post every week.

    One request, if you can post your detail thought on Pega Dynamic Class Referencing (DCR) ? it would be great 🙂

    Thanks,

    • Premkumar G Premkumar G

      Hi Chhatrapal Singh,

      You are most welcome. 🙂 Happy to hear that you like it.

      Yeah, I’ll post about that soon. Stay tuned. 🙂

  3. Ankur Ankur

    Spot On…..Too Good….

    • Premkumar G Premkumar G

      Happy to hear that you like it, Ankur. 🙂

  4. sharath sharath

    “Great job”

    • Premkumar G Premkumar G

      Thank you, Sharath. 🙂

  5. Chandra Chandra

    Great work Prem.. That clarifies all my misconceptions related to aggregate properties.

    • Premkumar G Premkumar G

      Glad to hear that it helped, Chandra. 🙂
      Thank you. 🙂

  6. Raghav Raghav

    Good One Man, Thanks !!

    • Premkumar G Premkumar G

      You are welcome, Raghav. 🙂

  7. Syed Syed

    Superbly explained. Learning many things from your posts. Thanks a lot for your efforts.

    It would have been good had u explained one of the example by using DT as it is a little bit different using these property types in DT.

    Awaiting for your next post.

    • Premkumar G Premkumar G

      Thank you so much for your appreciation, Syed. 🙂
      Glad to hear that you are finding the posts useful. You are most welcome. 🙂

      Okay Syed, I will try to explain about it in a new post. 🙂
      Stay tuned. 🙂

  8. Waseem khan Waseem khan

    Thanks and simply super!
    One request prem, can you please post configuration for email Listeners,that would be great for us😃

    • Premkumar G Premkumar G

      Thank you so much, Waseem Khan. 🙂
      Yeah, I’ll post about that soon. Stay tuned. 🙂

  9. Suresh Suresh

    It’s really good , and great help for all..

    • Premkumar G Premkumar G

      Thank you so much, Suresh. 🙂
      Glad that you find it useful. 🙂

  10. vinod vinod

    Thanks for the informative post with clear explanation .

    • Premkumar G Premkumar G

      You are most welcome, Vinod. 🙂

  11. Pradeep Pradeep

    Good one, Prem.
    Can you please help me on this.
    The option in the property form “Automatic reference to class instance(Linked)”
    Purpose of this option and how to use it?

    TIA

  12. Amar Amar

    Hi Prem, Thank you for detailed explanation. Really helped me a lot in understanding the concepts. 🙂

    • Premkumar G Premkumar G

      Hi Amar,

      Glad to hear that you found it useful. 🙂

  13. Pmk Pmk

    Great.. Sit can you please help us with some basic concepts with real time senators.. Like workbasket, workbook, work, etc.. Casemanagement, skimming. ASAP.. Thanks for ur help

    • Premkumar G Premkumar G

      Thank you. I’ll try to post about them soon. 🙂 Stay tuned. 🙂

  14. Mohan Poojary Mohan Poojary

    Extremely super Prem, the way you are explaining the things very well. waiting for the next post. subscribed…

    • Premkumar G Premkumar G

      Thank you so much, Mohan. 🙂
      Glad to hear that you like it.
      Stay tuned. 🙂

  15. Priyanka Priyanka

    Excellent post..my concepts are clear now 🙂

    • Premkumar G Premkumar G

      Thank you so much for your appreciation, Priyanka. 🙂

  16. jeh... jeh...

    Hello Sir ,

    how can I show to screen (repeating dynamic layout ) if the the property that holding a value is a value list.

    Or how can I copy the value of my value list property into pagelist property?

    Regards,
    Jerick

  17. Naresh Naresh

    Hi Prem,

    Thank you for detailed Explanation. Can you please explain what are the main differences between Property-Set and Data Transform? For which scenarios we will prefer DT or Property-set?

  18. Siva Parvathi Siva Parvathi

    Excellent Explanation

    • Premkumar G Premkumar G

      Thank you, Siva Parvathi. 🙂

  19. Parvez Parvez

    Hi Prem,
    Can you please write a post on report definition

    • Premkumar G Premkumar G

      Hi Parvez,

      Yeah, I’ll post about it soon. Stay tuned. 🙂

  20. Subuhi Subuhi

    Hi Prem,

    Very helpful and informational 🙂 Can you please provide details on user page, data page, linked property page and system page with examples?

  21. Ravikant Tiwari Ravikant Tiwari

    Hi Prem,
    Nicely written and explained.Learning by every of your posts.Waiting for next post.

    Regards,
    Ravi

    • Premkumar G Premkumar G

      Hi Ravikant,

      Thank you so much for your appreciation. More new posts are on the way. Stay tuned. 🙂

      Regards,
      Premkumar G

  22. shyam kumar shyam kumar

    Hii Prem

    Really it was good..keep posting many things..

    • Premkumar G Premkumar G

      Hello Shyam Kumar,

      Thank you so much. Yeah. I’ll keep on posting new stuffs. Stay tuned. 🙂

  23. ramya ramya

    Hi Prem,

    Can you please explain about following with real time scenario.

    What is the difference between Value mode and Page mode Properties? and
    How value List is differ from Page List?

    Thanks in advance.

  24. bharat bharat

    hi prem ,
    can you explain about pre and post processing actions
    thanks in advance.

  25. Tanu Tanu

    One day these drop will become an ocean! Great help thanks a lot!

  26. Sandeep Sandeep

    Great article and it’s very clear and easily understandable. Awesome 🙂

    • Premkumar G Premkumar G

      Thank you so much for your heartfelt appreciation, Sandeep. 😀

  27. chandu chandu

    can you please explain in detail when to place a property,data transform, section, activity or any other rule in data or work class. can you please explain in detail when to use data class and when to use work class.

  28. Shakti Misra Shakti Misra

    It was awesome and it was exactly the same I was looking for. The explanations are superb like a professional who understands user need. Thank you for your post. Keep it up and hope for many more.

  29. Shriram Shriram

    really awesome. thanks a lot prem

  30. adarsh adarsh

    Hi Prem,,,
    How to add(Like Mat Functions )In Value List Properties,
    Ex Item Price(1)=100
    Item Price(2)=200
    How to do that Practically

Leave a Reply

Your email address will not be published. Required fields are marked *

error: Content is protected !!