Question
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/1689993000/34e2fb88-5a16-4b7c-b901-4370fa0dd1ca.jpg?itok=nGScIuKe)
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/1689993000/34e2fb88-5a16-4b7c-b901-4370fa0dd1ca.jpg?itok=nGScIuKe)
RABO BANK
NL
Last activity: 22 Feb 2016 10:17 EST
Looping in HTML
Hi ,
I want to Loop two Page-List properties in HTML, can you please suggest me the syntax.
Thanks
Suresh Chella
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Accepted Solution
![](https://accounts.pega.com/sites/default/files/pega-user-image/35/REG-34624.png?source=PUMINIT)
![](https://accounts.pega.com/sites/default/files/pega-user-image/35/REG-34624.png?source=PUMINIT)
Pegasystems Inc.
GB
You might want to look at using the 'scratchpad' mechanism available for Pega Tags: where you can stash/retrieve values for later use.
I haven't tried this with 'dynamic' values, but it might be something to look into ? (Also: the help seems to suggest this works by using Javascript (clientside) so this also might not suit your requirement...)
The example usage in the help is:
To save:
<pega:save name="company" value="Pegasystems Inc."/>
To retrieve/reference:
<pega:reference name="$save(company)"/>
See:
prhelp/procomhelpmain.htm#jsp/save/jspsave.htm
prhelp/procomhelpmain.htm#jsp/referencingproperties.htm
![](https://accounts.pega.com/sites/default/files/pega-user-image/35/REG-34624.png?source=PUMINIT)
![](https://accounts.pega.com/sites/default/files/pega-user-image/35/REG-34624.png?source=PUMINIT)
Pegasystems Inc.
GB
To loop through complex PRPC Property/Page Types in an HTML rule - you can use the 'forEach' Pega Tag.
See this post here for an example of doing this: Re: Generate pdf dynamically with specific values from Pega UI
For convenience here's an example of the 'forEach' tag in use from that post:
<pega:forEach name="D_ChemList.pxResults"> <tr> <td><p:r n="$THIS.Name" m="literal"/></td> <td><p:r n="$THIS.AtomicNumber" m="literal"/></td> <td><p:r n="$THIS.Block" m="literal"/></td> <td><p:r n="$THIS.Description" m="literal"/></td> <td><p:r n="$THIS.Group" m="literal"/></td> <td><p:r n="$THIS.Occurrence" m="literal"/></td> <td><p:r n="$THIS.Period" m="literal"/></td> <td><p:r n="$THIS.State_at_STP" m="literal"/></td> <td><p:r n="$THIS.Symbol" m="literal"/></td> </tr> </pega:forEach>
If you need to iterate through two complex types: you can nest the tags.
To loop through complex PRPC Property/Page Types in an HTML rule - you can use the 'forEach' Pega Tag.
See this post here for an example of doing this: Re: Generate pdf dynamically with specific values from Pega UI
For convenience here's an example of the 'forEach' tag in use from that post:
<pega:forEach name="D_ChemList.pxResults"> <tr> <td><p:r n="$THIS.Name" m="literal"/></td> <td><p:r n="$THIS.AtomicNumber" m="literal"/></td> <td><p:r n="$THIS.Block" m="literal"/></td> <td><p:r n="$THIS.Description" m="literal"/></td> <td><p:r n="$THIS.Group" m="literal"/></td> <td><p:r n="$THIS.Occurrence" m="literal"/></td> <td><p:r n="$THIS.Period" m="literal"/></td> <td><p:r n="$THIS.State_at_STP" m="literal"/></td> <td><p:r n="$THIS.Symbol" m="literal"/></td> </tr> </pega:forEach>
If you need to iterate through two complex types: you can nest the tags.
See the help sections entitled: "Stream processing of JSP tags" and "JavaServer Pages tags" for more information on using Pega Tags.
http://<yourprpc:port>/prhelp/procomhelpmain.htm#jsp/alphaList.htm
Cheers
John
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/1689993000/34e2fb88-5a16-4b7c-b901-4370fa0dd1ca.jpg?itok=nGScIuKe)
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/1689993000/34e2fb88-5a16-4b7c-b901-4370fa0dd1ca.jpg?itok=nGScIuKe)
RABO BANK
NL
Hi John,
Thanks for you reply. My problem is a bit different.
I have a nested loop where I have to compare property value from outer loop with another value in the inner loop. If it matches, then I need to print the value on the screen. So far I am unable to find a way to store and retrieve the property from outer loop in a local variable that I can use to compare with the value in inner loop.
Thanks
Suresh
Accepted Solution
![](https://accounts.pega.com/sites/default/files/pega-user-image/35/REG-34624.png?source=PUMINIT)
![](https://accounts.pega.com/sites/default/files/pega-user-image/35/REG-34624.png?source=PUMINIT)
Pegasystems Inc.
GB
You might want to look at using the 'scratchpad' mechanism available for Pega Tags: where you can stash/retrieve values for later use.
I haven't tried this with 'dynamic' values, but it might be something to look into ? (Also: the help seems to suggest this works by using Javascript (clientside) so this also might not suit your requirement...)
The example usage in the help is:
To save:
<pega:save name="company" value="Pegasystems Inc."/>
To retrieve/reference:
<pega:reference name="$save(company)"/>
See:
prhelp/procomhelpmain.htm#jsp/save/jspsave.htm
prhelp/procomhelpmain.htm#jsp/referencingproperties.htm
![](https://accounts.pega.com/sites/default/files/pega-user-image/35/REG-34624.png?source=PUMINIT)
![](https://accounts.pega.com/sites/default/files/pega-user-image/35/REG-34624.png?source=PUMINIT)
Pegasystems Inc.
GB
Additionally: maybe you could create a third data structure : and populate this based on the match of the 'inner' and 'outer' values. Using a Data Transform to produce the third structure ?
Then you could simplify your HTML output just to loop through the third-structure you built in the DT ?
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/1689993000/34e2fb88-5a16-4b7c-b901-4370fa0dd1ca.jpg?itok=nGScIuKe)
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/1689993000/34e2fb88-5a16-4b7c-b901-4370fa0dd1ca.jpg?itok=nGScIuKe)
RABO BANK
NL
This one helped, thanks John
![](https://accounts.pega.com/sites/default/files/pega-user-image/35/REG-34624.png?source=PUMINIT)
![](https://accounts.pega.com/sites/default/files/pega-user-image/35/REG-34624.png?source=PUMINIT)
Pegasystems Inc.
GB
Hi Suresh,
Thanks - just to be clear: which approach did you opt for ? Using the PegaTags 'save' option or the Data Transform option ?
Cheers
John
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/1689993000/34e2fb88-5a16-4b7c-b901-4370fa0dd1ca.jpg?itok=nGScIuKe)
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/1689993000/34e2fb88-5a16-4b7c-b901-4370fa0dd1ca.jpg?itok=nGScIuKe)
RABO BANK
NL
Pega Tags Save
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/1689993000/34e2fb88-5a16-4b7c-b901-4370fa0dd1ca.jpg?itok=nGScIuKe)
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/1689993000/34e2fb88-5a16-4b7c-b901-4370fa0dd1ca.jpg?itok=nGScIuKe)
RABO BANK
NL
Hi jhon,
Can you please help on me the following case.
i know the syntax for exact match condition
<pega:when test=".Color == 'RED' " ></pega:when >
What is the syntax for "Contains or Like " ??
![](/themes/custom/pegacc_theme/images/user-icon.png)
![](/themes/custom/pegacc_theme/images/user-icon.png)
Hi Suresh,
Please start a new post for this question to get more specific responses!
Regards,
Lochan | Online Community Moderator | Pegasystems Inc.
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
Hcl Technologies
IN
.
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/1689993000/34e2fb88-5a16-4b7c-b901-4370fa0dd1ca.jpg?itok=nGScIuKe)
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/1689993000/34e2fb88-5a16-4b7c-b901-4370fa0dd1ca.jpg?itok=nGScIuKe)
RABO BANK
NL
Hi Sivanarayana
I cant see your reply