For Each Activity Variable issue

Hi @loginerror

I am using in my automation UiPath Studio 2019.10.5 and the activities package UiPath.System.Activities 20.4.0

If you declare a variable into the scope of the For Each activity with the same name of the iteration variable, you don’t receive an alert, but also it overrides the iterator value to the initialization value you have for your declared variable.

I know the duplicated variable cannot be identified at design time, but at least we can receive an accordingly error at run time, since the current message indicate the variable was null (Due to the declared variable on the inner sequence did not have initialization value)

Thanks,

Andres

Hi @AndresTarazona,
Are you able to provide example project? I would like to check it on newer Studio version.

Hi @Pablito

Thanks for your response. I uploaded here a test workflow with the behaviour explained above.

BlankProcess_ForEach.zip (11.4 KB)

Thank you very much. It helped me to understand where the problem is. So in other words the problem is that using name “item” for single element in For Each activity make all “real item” to being overwrite or just empty. Seems that it’s a kind of bug. I will report it to our devs. Thank you very much for this finding :slight_smile:

1 Like