I use a for each loop and in each iteration i get a output as datatable I need to store these multiple datatables in one datatable. How can I do it?

Is it possible to store it

@nikhil.s
if the column structures are the same so give a try on merge datatable activity

datatables will be same but data changes
i use for each and
ex
In first iteration
code amt
A001 500
A200 500
B100 100

second iteration
A006 500
A500 500
B300 100

dynamically depending on for each i wil give datatables
but i need output in one data table
Code AMT
A001 500
A200 500
B100 100
A006 500
A500 500
B300 100

Can we do it

Hi @nikhil.s,
Have you tried merge datatable?
Regards,
Aditya

as mentioned the merge datatable activity should help

sorry im new to these data table activities
data table name will be dtCode
in merge activity what should i use as source and destination

im new to these data table activities
data table name will be dtCode
in merge activity what should i use as source and destination
can you elobarate it please

Hi @nikhil.s
The steps are as follows-:
Declare a DataTable with empty rows and that will be your Destination DataTable,
Second DataTable will be your variable DataTable (Which is Source DT in Merge activity)
The output Destination will contain final DataTable.

If this helps mark this as solution.
Happy Automation!
Regards,
Aditya

@nikhil.s
find some starter Help here:
MergeDataTable_SameStructure.xaml (8.3 KB)

I will use filter datatable inside for loop, which dynamically changes inside values and gives output a datatable on each iteration of loop. i need to store each table in each iteration into one table. But using Merge is only giving last datatable output

@nikhil.s
recheck your implementation that it is not doing an unwanted overwriting leading to the result to get only the last datatable.

Your requested scenario was more often implemented in our projects and merge datatable did the job.

1 Like

Yes you are correct, It is making an unwanted overwriting, I found a fowl in my implementation! Thank you!