Condition within Input Properties of For Each Activity

I found documentation on the For Each activity, but I can’t find documentation on the Condition within the Input Properties of the For Each activity. I thought it would be evaluated before attempting the first iteration, but it looks like the Body of the For Each is evaluated once before the Condition is checked.
Screenshot 2022-10-21 091030

Hi,

It seems the condition is evaluated before first iteration, as the following.

Regards,

let us know your:
Version of UiPath.System.Activities
UiPath Version
selected Target framework
set Programming Lang (c#, VB)

Spoiler: yes some surprises with this setting are to encounter

@ppr, I am using VBA in Studio 2022.4.4 with UiPath.System.Activities 22.4.4.

I replicated @Yoichi 's workflow (without incrementing i), and it logged all integers {2,3,4,5} despite the condition.

Even incrementing i within the For Each, it still is continuing with logging every integer despite the Condition i<0 being false…

Hi @Joe_Matuch,

You don’t increment i here. You need to use item<0.

Regards
Ömer

I don’t think it matters? But in any case, still doesn’t work.

@Joe_Matuch,

Yes, you are right. I didn’t saw the second screenshot.

It doesn’t work on my Studio too.

Regards.
Ömer

lets ignore my different UiPath version so far

We assume that the for each is executed as long the condition is true

Level 22.4.4 - Check with hardcoded False
grafik
grafik
has output:
grafik

When updating to 22.10.3 and running the same we get
grafik
so condition is applied

a cross check with true: 22.4.4
grafik
so it runs the loop

a variation on use the item variable for the condition failed maybe due the UI Bug in my Studio Version. But using known variables for the condition (e.g. some test tests with the index output) did work

So feel free to do some other test / replications steps or provide feedback to UiPath via feedback category if there is not already a post present there for this issue

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.