Question
Plekhanov Russian University of Economics
RU
Last activity: 16 Feb 2021 7:51 EST
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!