For Each Activity: Not able to change Argument Type

I am not able to change argument type of for each activity.

@rizvana.mohammed

in the latest versions of for loop (system activities) type argument need not be changed or is not exposed to change…it is automatically choosen based on the input collection that you provide

this is an expected behaviour

as you provided list of strings ..a string argument type is auto choosen

cheers

Hi @rizvana.mohammed

You are using Modern For Each, so UiPath automatically decides the type from the list you give.

Try this
1 Directory.GetFiles() returns String()
2 Take Assign activity

GroupedFiles = Files
3 set variable GroupedFiles : IEnumerable(Of String)
4 use for each

List of items = GroupedFiles
5 do not change argument type

CurrentItem : String
6 use inside the looop

CurrentItem (file path)

Thanks

From where we get the variable CurrentItem. Because i have 2 nested for each loops

@rizvana.mohammed

In nested loops, each loop has its own CurrentItem, so you should rename them to avoid confusion.
Example

Outer loop:
1 Drag Modern For Each.
2 Values → GroupedFiles (your outer list)
3 Rename CurrentItem → CurrentFile

Inner loop:
1 Drag Modern For Each inside the outer loop.
2 Values → GetLines(CurrentFile) (your inner list based on outer item)
3 Rename CurrentItem → CurrentLine

CurrentFile - refers to the outer loop item
CurrentLine - refers to the inner loop item

Thanks

how we can refer the item that is looping

Hi @rizvana.mohammed

You can get to use

Add to list () and type argument in for loop as well use igrouping(Of String, string)

Hope this works !

@rizvana.mohammed

the variable would start with current..just type current and ctrl+space the name would appear

cheers

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