Sunday, June 18, 2023

CSV format string from a Pagelist

In our business logic often we have the requirement to convert PageList to string CSV values.


From - 

PageList.pxResults(1).pyLabel  = P1

PageList.pxResults(2).pyLabel  = P2 

PageList.pxResults(3).pyLabel  = P3


To – "P1","P2","P3"


We need to convert this above page list to a comma-separated value.

There are many ways to achieve this. but the easiest way to do this using an OOTB function 


@pxDataManipulate.pxStringCSVFromPageList

@pxDataManipulate.pxStringCSVFromPageList(PageList,".PropertyName")

This function takes 2 parameters.


pageList - PageList that needs to be iterated

propertyName - property whose CSV is needed


e.g 

@pxDataManipulate.pxStringCSVFromPageList(PageList.pxResults,".pyLabel")

In the above function 


PageList.pxResults - Page List 

.pyLabel - Name of the property whose CSV is needed 








No comments:

Post a Comment

Featured post

Queue Processor

  Overview Starting with Pega Platform version 8.1, Job Scheduler and Queue Processor rules replace Agents and improve background processi...

Popular Posts