Update data table row if a match

Hello,

I have two data tables. The first contains a list of company names that i filter against the second data table to see if there is a match. If there is a match i want to update a “Match” column in the first data table with a Yes.

FAME Validation.xaml (30.5 KB)

Hi @jon1302

I checked your workflow file. In your Filter datatable activity, you are trying to filter your datatable by a value that is contained in a variable. But as I understood the flow of your workflow, this variable gets the value from another loop. And that loop is getting executed until it reaches the last record of the datatable. So, by the time it gets to this filter data table activity, that variable only has the value of the last record of that datatable.

In this scenario, it will filter your datatable only by the last record. It will not iterate the entire datatable and find matches. So I believe the logic used here is not right. Additionally, you can find the matching records easily by using Join data table activity.

I have done the same scenario here in the attached workflow which I created for you. Please have a look to see whether it serves your purpose. You can incorporate the logic used here to get your workflow working as required. In this workflow, it extracts data from two excel files. Then compared the two using join data table activity with Inner Join to find matching records. Then I loop the matching records data table with the datatable I got by the read range of the first excel file. In the loop, all matching records are added with a “Yes” flag to a new column. FInally, it adds the new data back to the first excel file.

I guess this is what you want to do…

MatchDataTables.xaml (9.3 KB)

If this works for you, please mark the answer as the solution so it could help others as well :slight_smile:

Let know how it goes

1 Like

Thank, though would like to modify it further. I’ll use the join table to find my matches and join the data i need but is it possible to also create another data table of the entries that did not match?

FAME Validation.xaml (29.5 KB)

Hi @jon1302

Yes… it is possible I have modified the previously sent workflow a bit to add the records that do not match to another datatable and write to a excel.

MatchDataTables.xaml (10.6 KB)

Let know if this works for you…

@jon1302

is it what you are looking for ?

matchtwosheets.xaml (14.6 KB)

Hi - I have a similar situation and comparing whole row, what would be the value of citypresent into loop.

DT1 - 5 columns
DT2 - 5 columns
if row match then add col to DT2 (6th Col - heading Match)

Thanks