I have found iterating through Page Groups is syntactically the same as iterating through Page Lists.
If it is a full copy of one Page Group to the other, you may find that a single Set statement in a Data Transform does the job:
Set .TargetPageGroup equal to .SourcePageGroup
If you are looking to append(/merge) the contents of the source page group into an existing target that already has other items in it, iterate over source page group and use each element's .pxSubscript property to determine the 'key' you need to set in the target.
Again look to use the Data Transform rule for copying properties or pages, and you might be surprised how few steps are needed.
Posted: 1 year ago
Updated: 1 year ago
Posted: 5 Feb 2021 12:15 EST Updated: 5 Feb 2021 12:23 EST
Chakri Payyavula (ChakriP8)
I learned the pxSubscript technique through inspecting the Clipboard Viewer of each entry in a Page Group to see if there was a way I could identify each of the elements. I encourage you to explore the Clipboard Viewer and Tracer as the key tools to help you learn the next level of detail about what is available at runtime to influence your design approach.
Also, challenge yourself on whether this needs to be an Activity.
Steps 2 and 3 can be fulfilled with Data Pages that use Lookup as their Data Source;
Steps 4, 5.0 and 5.1 are property assignments using the Data Page loaded from Step 2, which can be implemented using a Data Transform.
If after Step 5 you are doing something to copy the old survey to the new, and then even to persist the new survey to its data store, these too can be accomplished with Data Transforms and Savable Data Pages respectively.
If you must stay within an Activity, instead of assigning temporary data to items on the Parameter page, prefer Local Variables (from the Parameters tab) to hold state that is not needed outside of the Activity which can be discarded it ends (like your 'ss' variable). Otherwise you risk having state 'stick' to the parameter page that can unintentionally impact how other rules in that interaction behave.