Question
Cognizant Technologies
IN
Last activity: 6 Mar 2017 1:40 EST
Fetch/Create a PageList of results from an existed Pagelist doing filter(when-true) without looping over the complete list
Hi,
Suppose there is an existed Pagelist(Node level DataPage) eg:TempMaster(). Now I want to filter the list from it with a when condition and want to create a new PageList out of it eg:NewPageList().
Here I don't wan't to loop over, filter and then append from the pagelist (TempMaster()) because its very long list that might contain more than 5000 records. Also I don't want to hit the DB table using Report-Definition or Obj-Filter as there would be too many hits needed in my case.
Is there any OOTB method or function to create a new pagelist from existed pagelist with some filter conditions?
Please suggest.
Thanks, Shoyeb Khan
Hi,
Since you have to select the embedded pages from the original page list based on a when rule, you don't have a choice but to check each embedded page over the when rule. What can be avoided here is to not have an activity step where you loop on the original pagelist and use the when rule in the precondition of the child step and then copy the embedded page into the new pagelist which matches with the when rule,. Instead you can use a custom version of the IsInPageListWhen function.
Use the below code:
boolean retValue = false;
PublicAPI tools=ThreadContainer.get().getPublicAPI();
Iterator it = lookIn.iterator();
while (it.hasNext()) {
ClipboardProperty next = (ClipboardProperty) it.next();
ClipboardPage nextPage = next.getPageValue();
if(pega_rules_utilities.callWhen(tools,whenName,nextPage) == true) {
appendTo.add(next);
retValue = true;
}
}
return retValue;
Here, lookIn will be the original pagelist i.e Orig.pxResults
appendTo would be New.pxResults
whenName would be the name of the when rule that is in the same class as that of the class of the embedded pages in Orig page. i.e Orig.pxResults's pxObjClass value.
Also added the screenshots of the processing.