Question

2
Replies
63
Views
Close popover
Daria Mamaeva (DariaShalom)
Plekhanov Russian University of Economics

Plekhanov Russian University of Economics
RU
DariaShalom Member since 2019 11 posts
Plekhanov Russian University of Economics
Posted: February 12, 2021
Last activity: February 16, 2021

Group page list into page group

I need to write a function that groups page list results into page group by defined property and appends a list with results.

Please see attached screenshots. 

java code:

PublicAPI tools = ThreadContainer.get().getPublicAPI();int length = sourcePageList.size();

for (int index = 1; index <= length; index++) { String stringProp = sourcePageList.getPageValue(index).getString(keyPropertyName); String Key = abrint_utilities.EnsureValidGroupSubscript(stringProp); ClipboardPage target = targetPageGroup.getPageValue(Key); if (target == null) { target = tools.createPage("targetClass",  ""); targetPageGroup.add(Key, target); }

target.getProperty(".pxResults").add(sourcePageList.getPageValue(index));

}

 

Parameters are:

sourcePageList  ClipboardProperty

keyPropertyName String 

targetPageGroup ClipboardProperty

targetClass String

The problem is that pxPages are Classless,IF statement return false and method createPage doesn't work as expected.

I've tried to remove this check but then target.getProperty(".pxResults").add(sourcePageList.getPageValue(index)) doesn't work

Also I've tried to use targetPageGroup.getPageValue(Key).add(sourcePageList.getPageValue(index)) but then I get only 1 pxResults into pxPages.

I need to implement it by function without activities or data transforms.

Thanks!

***Edited by Moderator: Pooja Gadige to move from Pega Academy to Product, add platform capability tag***
Pega Platform 7.2 Data Integration