Discussion

2
Replies
13078
Views
EdgarPDN Member since 2015 12 posts
SynTouch
Posted: 4 years ago
Last activity: 4 years 8 months ago
Closed

Defining a loop over page list in pyWorkPage

After having finished the Activity exercise in the SSA course the behavior of the Loop construct got me thinking...

On my RequestAssets section I've created two separate grids holding:
- Current (read-only) list of assets from D_AssetList data page
- An editable grid referring to a Assets page list for extending these with new assets

My post-processing run activity should loop over .Assets on the Clipboard; which are of the same class (SAE-HRServices-Data-Assets). Is it correct to define a Loop with "Repeat For Each Page"? What's the purpose of "Step Page" when I define a Loop and why isn't this text box disabled when the documentation states "Leave the Step Page field blank."?

- How do I tell PRPC to specifically loop over this Clipboard page instead of D_AssetsList which is of identical class?
Tracing shows me it iterates over the wrong page list somehow holding all twenty-something assets instead of the one or two I'd like to add. I would rather implement logic that iterates over the rows in a separate grid than relying on the "OnlyIfNew" parameter of Save-Obj.

- How do I test whether a page list actually has items (children) or is empty? Does it matter whether those children are plain properties or embedded pages?
In pyWorkPage is see one page named Asset, but it has no contents. I try to make good use of "Enable conditions before this action", but any precondition still results in a pyCommitError. I assume the Steps in this loop still get executed. This is why I would like to learn to common practice from the available library functions for testing an possibly empty set or properties.

Pega Academy
Moderation Team has archived post
Share this page LinkedIn