how to call a when rule defined in 1st level loop page in 2nd level loop

how to call a when rule defined in 1st level loop page in 2nd level loop?

assume a, b are both page list, in below, “Also use each page as source context” checked box are checked. A when rule IsXXX is defined in class of a.

For Each Page in a

1st level loop body, IsXXX can be called here normally by When command.

1st level loop body, pxGetStepPageReference() can be use to get current page of a.

For Each Page in b

2nd level loop body, IsXXX can NOT be called here by When command.

in 2nd level loop body, I can access properties in class a by get current page of a ,but can not use this to access when rule.

Hi @MaxonL16591286 : Logically you can achieve this in multiple ways.
If any conditions to be checked in class a, you can do it in the first loop and set the output in a parameter and can use parameter value in your inner loop.

Use update page option in inner loop using the steppageref captured in outer loop. Do the when rule check inside update page to get the output in a parameter and use it.

Set the required values from outer loop in parameter and use the when rule in inner loop to check parameters instead of properties.

Please help us to understand the use case of the above doesn’t helps.

Thanks.

@ArulDevan Thanks!

About your shared solutions:

  1. If any conditions to be checked in class a, you can do it in the first loop and set the output in a parameter and can use parameter value in your inner loop.

— Not fine, as I need pass param from 2nd loop to the when rule. Inside the when rule, the param is used to determined the logic, so I must call the when rule in 2nd level loop

Use update page option in inner loop using the steppageref captured in outer loop. Do the when rule check inside update page to get the output in a parameter and use it.

— Sounds fine, will try it. In the Update page, actually nothing need updated, just call when rule and store result into a para, right?

Set the required values from outer loop in parameter and use the when rule in inner loop to check parameters instead of properties.

— Not fine, “use the when rule in inner loop” is just what I can not do. Pega report error.

@MaxonL16591286

Use update page option in inner loop using the steppageref captured in outer loop. Do the when rule check inside update page to get the output in a parameter and use it.

— Sounds fine, will try it. In the Update page, actually nothing need updated, just call when rule and store result into a para, right?

— This solution is fine! Thanks!