Posted: 11 Jun 2019 17:15 EDT Last activity: 17 Feb 2021 10:12 EST
Looping through pxResults
I need to loop over search results and find something in those results and create another pagelist if my results contain something I am looking for.
As shown in my picture, I need to loop over the pxResults of class Data-Find-Results and if I find the keyword 'Spanish' in either pxInsName or pzInsKey of the property, I need to create another pagelist of class Data-Find-Results and populate that new pagelist with pxResults(9).
Can someone show me how to do this preferably with a diagram.
The key word would not be found multiple times. One single iteration over the pagelist should be good. I need to know how I can get a 'handle' on the pagelist to iterate over it and then compare and then populate another pagelist.
Can you please 'show me' as I am new to pega. I am not looking for a single instance.
The word Spanish can be found multiple times, say at index 6 or at index 211. Because two instances are found, I need to create a new pagelist and copy over the result set at 6 and 211. So my new pagelist will be of length two and will have the records pxResult(6) and pxResults(211) of the original pySearchResults pagelist. Can you please paste a picture of your activity.
I misunderstood your question. The keyword Spanish could be found multiple times in the pagelist. So I would need to iterate over the whole list. Can you please 'show' me with a picture how I can grab a handle on the pxResults pagelist and the iteration over it. I am not sure how to use 'for each embedded' in the activity I am creating to loop.
Thanks for posting the pics and giving such a beautiful explanation! It worked. I am able to loop through pySearchResults.pxResults(). However I need to populate the SearchQRPage Pagelist with the exact same data at index 6 and index 211 i.e. copy the values over from pySearchResults to SearchQRPage.
When my When condition is true, I need to add to SearchQRPage the pxResults of pySearchResults.pxResults(6) and pySearchResults.pxResults(211), so that the size/length of my SearchQRPage Pagelist is now 2.