Compare 2 columns from 2 DT and update the 2nd DT column for only matched rows

Hello All,

I have 2 DT,

DT1 with 10 rows and DT2 with 500 rows. (20 columns)

I want to match ID column of DT1 to ID column of DT2,
If matched, want to update Reason column of DT2 with some static text (only rows which got matched)

DT1
image

DT2
image

Final DT
image

@ppr

Thanks,
Rushi

Please find the below the solution

UpdateDt.zip (3.1 KB)

Hi @muhamed_fasil ,
I guess something is wrong with the file, unable to open.

Extract the file to your system and then open from the file
UpdateDt.zip (3.1 KB)

For Each r as Datarow in d2.Asenumerable
r(“Reason”)= if(d1.Asenumerable.Count(Function(r1) r1(0).Tostring.equals(r(0).Tostring)>0,“Matched”,r(“Reason”).Tostring)
Next r

Here : I Mapped as Matched For Matching values and Unmatched For Unmatching values …Replace your value there

Note : Try this in invoke code.

If you can see, I am trying to launch the .xaml file and it continuously says restoring dependencies

waited almost 5-7 mins.

Thanks,
Rushi

@Gangadhar_Athili wow,

This is working perfect.

Just want to know what if I don’t want to update the else condition i.e. I don’t want to update unmatched row?

I tried removing else condition of UnMatched rows but it is over writing data with else condition.

Thanks,
Rushi

Above Query Updated

Check it Once

Working as expected,

Thanks a lot buddy,
Keep spreading knowledge.

Rushi

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