Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Usage of Loop and When

Scenario:
Get the operators who are skilled in one particular language. Activity to get all the
operators who are skilled in the language that was passed as parameter to the activity.

Approach:
Create an activity rule GetSkilledOperators

Detailed Steps:
1. Create an activity GetSkilledOperators in TGB-HRApps-Work class. The activity
Steps, Parameters and Pages & Classes tab
2. In Step 1, use the method Page-Remove to remove the page “AllOperators” from
clipboard.

3. In Step 2, use the method Obj-Browse on Data-Admin-Operator-ID class and get


all the operators and their skills.

Results are stored in AllOperators page list.


4. In Step 3, Loop through AllOperators pagelist using for each embedded page.

5. Right click on Step 3 and choose “Add Child”

6. In Step 3.1(image), use the Property-Set method to populate the local variable
count.
7. In the Step 3.2, for each embedded page in AllOperators, loop through pySkills
pagelist and use the method Page-Copy
Page-Copy method Parameters:
• CopyFrom AllOperators.pxResults(Local.count)
• CopyInto FilteredOperators.pxResults(<APPEND>)

8. In Step 3.2, add a when condition to the Page-Copy step that checks pySkillName
with the parameter passed.
The Operators whose skillname matches with the parameter are copied to
FilteredOperators pagelist.
Test Activity

1. To verify the activity, update few operator records with SkillName as


“French”. Access Operator ID record and add Skills e.g.French in Work
tab.

2. Run the Activity by providing the parameter as “French”.

3. In the clipboard, find the embedded pages FilteredOpeators PageList


contains the operators whose skills contains French.

4. There are 3 operators as shown in the below screenshot.

You might also like