How to edit a row if two data tables columns match without for each loop?

So I have two datatables DT1 and Results_Matched, I want to compare 3 column of DT1 and 3 column of Results_Matched if matched then change DT1 10 column value to Matched. what is the most efficient way without the foreach loop?

what is your identifier across both tables?

Are you matching ‘ABC’ in row 1 on DT1 against any row in Results_Matched?

How many rows would you want to be matching against as you will probably have to use a foreach loop in DT1.

To try and match against Results_Match you can use Results_Matched.Select(“Column3 = '+item(“Column3”)+”’") to see if it pulls back any rows that match :slight_smile:

If the array of datarows is empty then its no match, if it is then updated DT1 column 10 to Matched.

Hope that helps.

I’m comparing 3rd column rows of DT1 with 3rd column rows of Results_Matched. if it matches with DT1 3rd column row then it should change that particular DT1 10th columns row to “Match”

You can use as I suggested above, to update that particular row.

In the if statement, if it matches you can use an assign row.item(“Column10”) = “Matched”

I’m getting this error

You are missing a closed "

Updated below:
Results_Matched.Select(“Column3 = '"+item(“Column3”)+”’")

Are the column headers called Column3 or something else as you will ahve to amend to match that.

:frowning:still problem is there. thank you so much for helping me
yes the column name is Column3 in both table

you are still missing the " after the first ’

Results_Matched.Select(“Column3 = ’ " + item(“Column3”)+”’")

Also try change the " and ’ in my string once you have copy pasted as it may be formatted.

1 Like

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