Assign to all rows in datatable without using forEach row

Hi Devs please I have a process I’m working but I need to assign to the second datatable without using for each row activity cause the first datatable is already inside forEach row activity so using another nexted forEach row activity for second datatable makes the process take long to execute.

Hey,
You can use merge data table activity
Its easy to merge a datable to ano ther data table
Thanks

Hello @stanstilo

Are yo trying to get few columns from one Datatable to another based on some identifiers??

For example you have 2 Datatable A & B

Want to join B with A based on some unique column. Is that the requirement??

If yes you can use Join Datatable activity.

No I’m not joining the tables, so I want to loop like this
For Each row in dt1.rows
For Each row2 in dt2.rows
if row2(“amount”).ToString.equals row(“amt”).ToString then
row(“account”) = row2(“acc”).ToString
End If
Next
Next
But then is there a better code to replace row2(“acc”).ToString cause it takes a lot of time to loop through these rows as I am using the nexted for each activity for it

Can you share the screenshot of the 2 tables and the expected output… That will help to give a better solution

Hello Stanley,
To avoid for each inside of for each you need to use Dictionary I have here an example from the exact time stamp of this movie:

for a general video of the dictionary check this (but first video is exactly your case):

Thanks,
Cristian