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


#1

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


#2

For each row?


#3

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

Thanks


#4

Which database you mean here? SQL Database?


#5

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


#6

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


#7

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


#8

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


#9

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


#10

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


#11

Use “Add to Collection” Activity