Thursday 26 March 2020

Count In Page List Pega expression


Count In Page List Pega expression

Hi Friends, today we will practice the Page List expression provided in the below Pega help URL.

https://community.pega.com/sites/default/files/help_v718/definitions/p/pagelist.htm

Wrote a sample activity in work class to browse the list of pages from Courses data class.



Courses Data table


countInPageList(LookFor, LookAt, LookIn)


This expression will provide the Match count . 

LookIn- PageList name in which we want to search.
LookAt- which property we have to search for value.
LookFor - Value what we have to search in the Property.


Now If I want to get the Number of records having Hours = 2 , then I will use this expression .
 



From the table we can see for 4 records hours is 2.

In Property-Set added expression to get the count of pages which having hours 2.

Value will return in Count Parameter.


Lets run the activity and check the result in Parameter page.

Activity ran and traced 


In Event Line 7, we will check the parameter page.

We can see the result as 4 in Count Parameter.

countInPageListWhen(WhenName, LookIn)


This expression little bit same as above expression. 

WhenName - We can use the when condition to evaluate the data in the Current Page of PageList.
                       If the when condition becomes true then count will increase by 1.

LookIn- PageList name in which we want to search.


In acitivity added the expression, If when condition SalesDepartment becomes true then count will increase by 1.




When Condition

This when condition becomes true when current page in page list have department contains Sales.

Lets run the activity and check it.

In the tracer we can see when condition became true for record 9 and 10. So Count should be 2.


Result:

Count is 2.



other expression will see in next post. Ask in comment if you have any doubt😊

4 comments:

  1. Wow Mate, Brilliant work. I use to see this kind of PDN, but i can't understand you made it so easy. Please make More Post's. Keep Going. Cheers!

    ReplyDelete
  2. i am doing same but not getting count

    ReplyDelete