Assign values from one datatable to another with multiple lines and repeat column values


I am having two datatables in File1.xlsx (11.7 KB) having sheets

Main image

input image

And the required output sheet

output image

Here, if in ‘Main’ column MatchingCode and SQFT = in ‘input’ column MatchingCode and SqFt

Then assign all the values of column Color Code and FinalSqFt (of input sheet) to RM Color Code and Req. Qty (of main sheet) and repeat all the column values like “MAP and RPO” of main to the added extra lines.

If no match found then be the lines as it is.

Please help.

1 Like

Hey @Swara_Soni

Two approaches are possible here,

  1. Foreach looping
  2. Linq querying

If you are a beginner please go with for-each looping.


We can do it with the help of Join DataTable Activity
first Dt = dtMain | second Dt = dtInput | out: dtReuslt | JoinType = Left

Afterwards we can remove and reorder the unneeded Columns from Join result with the help of Filter datatable by configuring the column handling and letting the row handling untouched

For a more custom handling we would use LINQ

Thanks @ppr and @Nithinkrishna
I used join datatable activity ->left join and got the desired result.

Thanks a lot for your sharings

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.