How can i create an array of Datatables and loop through it?

Hello,

I would like to create and loop through an array of Datatables (unknown number in each execution) and invoke a specific process which finds the sum of certain columns.

Could you please guide me in that/?

Thanks

Thanos

For each row?

How i can i create the array of datatables in order to use For each row?

Thanks

Which database you mean here? SQL Database?

No, i am reading 5-8 csv files and creating datatables. Then i want to invoke the same process for all those datatables created

In that case you can use Directory.GetFiles(“FolderPath”,“File Extension”), this will give you an array then you can apply for each loop on it and perform operations on each file

Goto Variables panel —> Goto your variable —> variable type select Array of [T] -->select Browse for types, then search for DataTable

1 Like

Initialize a list of datatables and for each csv file read range and add to collection. Then you can simply loop through the list.

1 Like

Thanks bala! and how can i assign the datatables to the array dynamically?

https://www.uipath.com/kb-articles/how-to-work-with-a-dynamic-array I think this should help you

1 Like

Use “Add to Collection” Activity