How to store each iteration value in single output table

Hi Team,

I am using one for loop activity & inside that i have used extract data table activity. The process is working fine as expected & extracting data also but i want to store every iteration extracted data in single output table?
please help me how to store in single table?

Hi @Smitesh_Aher2

You can make use of Merge datatable activity

Only for the first iteration you can Clone the ExtractedDT and Store it in MasterDt

If masterDT.Columns.Count = 0
Assign → masterDT = currentExtractDT.Clone()

And for the rest of the iteration Merge ExtractedDt with MasterDt

Hope this helps!

1 Like

@Smitesh_Aher2,

First, define a master DataTable with the same columns as your extraction DataTable outside of your loop. Then, for each iteration in your loop, after extracting the data, merge the current extraction DataTable into the master DataTable using the Merge Data Table activity.

This ensures that all the extracted data is preserved in one combined table.

1 Like

@Smitesh_Aher2

when you extract extract the data to say variable dt and then use merge datatable and give input as dt and output as mergeddt

after loop mergeddt will have all data

sample

cheers

Hi All,

After using merge data table activity i am getting error as “Object refrence not to be set as instance” .

Hi @Smitesh_Aher2

In the properties of Extract table data activity find the Append results option and enable it.
While extracting the data everytime it will helps to append all the data in a single datatable.

Check the below screenshot for better understanding,
image

Hope it helps!!

@Smitesh_Aher2
Make sure to clare the variables
Declare your MasterDt in the beginning
Assign →
MasterDT = New System.Data.DataTable()