- I am using find children activity to get child item and getting child item.
- lets say I get 10 ui element.
- Now using for each loop, iterating through each ui element and using get attribute of ui element( ui element of point no. 2)
however I don’t want to get attribute of 10th item, how to eliminated that i.e. how get attribute of only 9 item.
@gupta.rak1984 using if loop check whether current element in loop is last element of the array. If condition is true then do nothing otherwise do necessary operations.
To find current item index in array method will be something like below. Check method once in forum or Google once.
Array.indexOf(arrayName,loop variable) or Array.indexOf(loop variable, arrayName)
an alternate approach could be to limit the list to nine elements in advance with the help of an Take Statement: https://www.tutorialsteacher.com/linq/linq-partitioning-operators-take-takewhile
For the calculation of which nth element the loop is running the For Each Activity index can be used as well:
Index - A zero-based index that specifies which element of the current collection is being iterated, stored in an
Stopping the for each loop is done with the Break Activity:
Again you got the answer in your query itself buddy
Yes these are steps to be used
—inside the for each loop at last mention use a assign activity like this
counter = counter + 1 Where counter is a variable of type int32 with default value as 0 defined in the variable panel
—next to this assign use a IF activity like this
counter = 8
If this is true it will get into THEN part where we can use a BREAK activity so that once after reaching 9 element it will get out of for each loop
That’s all you are done
Kindly try this and let know for any queries or clarification