Question
Wipro
IN
Last activity: 18 Dec 2017 6:14 EST
For Each Page - Loop
I need to get the list of mappings in Connect REST rules across my application. I tried to write my utility with below:
Step 1:- fetch the list of connector rules
Step 2:- loop over the results and set the key in local variable
Step 2.1:-Open by handle (Used TempPage as Step Page)
Step 2.2:- Loop: For Each Page with property-set
Since it is Connect Rest, I could find the mapping details in some page inside TempPage (like pyDeleteRequestData inside TempPage)
Since there are 4 methods(like post, delete..) instead of hardcoding the page name and checking the value, I tried to use "For Each Page"
but Pega always tries to find the pages inside Top level user pages and not inside TempPage. I want to get the Page (not page list) inside TempPage with class Embed-InterfaceParameter
Could someone please correct if I am doing wrong?
***Edited by Moderator Marissa to update categories***
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
JPMorgan Chase & Company
US
Hi,
Could you please attach the screenshots for analysis ?
Wipro
IN
I Couldnt take. But simply, the issue is., I am trying to open a Connect Rest Rule in a top level page
TempPage(Rule-Connect-REST)
I have several embedded pages inside that top level page of same class.
TempPage.pyDeleteRequestData (Embed-InterfaceParameter)
TempPage.pyDeleteResponseData (Embed-InterfaceParameter)
TempPage.pyPutRequestData (Embed-InterfaceParameter)
TempPage.pyPutResponseData (Embed-InterfaceParameter)
TempPage.pyGetRequestData (Embed-InterfaceParameter)
TempPage.pyGetResponseData (Embed-InterfaceParameter)
TempPage.pyPostRequestData (Embed-InterfaceParameter)
TempPage.pyPostResponseData (Embed-InterfaceParameter)
The above pages are embedded pages (not page list) inside TempPage.
I have to check .pyMapFromKey exists in any of these pages and if yes, I have to get that value.
So, instead of hardcoding the page name and getting the value, I tried to use ForEachPage in loop.
I left the StepPage blank and included Rule-Connect-REST in Only Loop Certain Class field. Pega took the steppage as TempPage dynamically at run time.
Similarly, I want to get the Pages (of class Embed-InterfaceParameter)inside TempPage. It should dynamically determine the StepPages (of class Embed-InterfaceParameter) inside TempPage, instead of hardcoding.
Please let me know if you are not clear on my query.
Pegasystems Inc.
IN
Hi Soumya,
Suppose you have to loop again at a child page of structure list like TempPage.pyDELETERequestDataList Instead to loop through pxResults of that.
Try creating another named page as TestConectRest of Code-Pega-List(copy TempPage to TestConnectRest if required) and TestConnectRest.pxResults of type Embed-InterfaceParameter.
Now TestConnectRest becomes the top level page and you can again loop through TestConnectRest.pxResults.
Thanks,
Ujjwal
Wipro
IN
Its a page and Not a page list. I have explained the query in details above. Kindly refer and let me know
Pegasystems Inc.
US
Hi,
What could understand is there is a page "TempPage". Inside this page, there is another set of pages eg "TestPage" etc. So, you can also use a java step to iterate over this.
ClipboardPage mypage = tools.findPage("PageName");
java.util.Set propertySet = mypage.keySet();
java.util.Iterator properties = propertySet.iterator();
while(properties.hasNext())
{
pageName= (String)properties.next();
//check your values in this *pageName*
}
Regards,
Rachit
Wipro
IN
Thanks Rachit.I will try the above. But, is it possible to achive with Pega? Using "For Each Page"?
Pegasystems Inc.
US
HI Sowmya,
We dont have any option to loop through page content. Activity method Loops applies only to page list/page group.
Wipro
IN
Could you please let me know the use of "For Each Page"? how we can use it?
JPMorgan Chase & Company
US
Hi Sowmya,
Please refer below pdn article
Pegasystems Inc.
US
As discussed earlier, you can use For Each Page to loop through the pagelist/pagegroup. In JAVA terms, for any looping activity, we need to have some list/array data structure. I think Single Page does not provide that data structure.
Wipro
IN
Could you please help me in completing this java code? Like I need to copy the looped pages into Another page list
Eg:- TempPage.pyPostResponseData, TempPage.pyDeleteResponseData to ResultsPage.pxResults(1), ResultsPage.pxResults(2).