Posted: 16 Jul 2020 18:10 EDT Last activity: 21 May 2021 12:38 EDT
Referring to top level step page when a child step has a step page
In a loop step of an activity, say I have a step page called .Courses of class TGB-HRApps-Data-Courses which has a property called .CourseName, lets say this is row number 4 in an activity
If no step page is specified on the child step then .CourseName for example would need no index since it is in the context of the iteration. I can just refer it to it as .CourseName by itself and that would be equivalent to using the <CURRENT> symbolic index
Now I have a child step of the iteration 4.1 that has a different step page, lets say Teacher. Without a page prefix the dot operator will refer to properties of the Teacher step page class within the step. But how would I refer to a property of courses on the current iteration for the "outer" step page .Courses? - is there a shortcut without using the <CURRENT> index.
My thoughts are (.Courses is a page list defined on the class of the activity)
1. Refer to it as Primary.Courses(<CURRENT>).CourseName
2. Use the Top keyword. Would this make sesne in this situation and would I have to define Top on Pages&Classes? Thus I could refer as Top.CourseName and I would not need an index same as no step page specified
Is there another alternative?
Thanks. I hope my question makes sense.
***Edited by Moderator: Pooja Gadige to add platform capability tag***
Primary.Courses(<CURRENT>).CourseName will give the correct Course name in the Teacher step page , but if you do not want to use this , you can have a property-set at your step 4 .Courses loop, set .CourseName to a parameter lets say Param.CourseName, in your child step 4.1 , you can use this parameter directly .So each time , your loop runs, parameter will have current iteration Course name.
@JMark515 Any of the below approaches can be followed
1. Store Course Name in some parameter or local variable and this can be referenced inside Teacher which is child loop under Courses loop.
2. Param.pyForEachCount contains the index of current iteration. Copy this value in to local variable before Teachers loop is started. Inside Teachers loop refer the CourseName using Primary.Courses(Localvariable/param).CourseName. <CURRENT> cannot be used when we need to access parent loop information inside child loop as it refers to current iteration which is basically Teachers iteration in child context.
3. By using pxgetStepPageReference() function we can get the step page of course name in to a parameter of type page and then reference the property CourseName inside Teachers loop using this ParameterPageName.CourseName.