Comparing the same row from two datables

Dear reader,

I would like to compare:

  • row1 from DT1 with row1 from DT2
  • row2 from DT1 with row2 from DT2 etcetera

At the moment I use a ForEach in a Datatable embedded with a ForEach in a Datatable. This combination gives me of each wrong value, 20 times (this is the number of rows in DT2) this wrong value.

I would like to see each unique wrong value once.

Who could maybe help me with an answer?

Best, Matt

Hi @mattsheep

You are doing great, you have to put an “for each row” inside antoher one.

  • row 1Âş DT: row

  • row 2Âş DT: line

for each row, inside another for each row, and then:

row(“X”).tostring = line(“Y”).tostring

To check 2º, 3º or “n” row, make a variable to count the rows for example, you can do that in many ways.

Bests,
Pablo

Dear @Pablo_Sanchez,

Many thanks for your quick reply. I tried your solution and thanks for that, however I still have the same double outcomes. See the snapshot.

Capture

I added the workflow and the Excel to this topic, if it’s possible, maybe you could have a look?

I also don’t understand the rowcounter. Do you maybe have an example for that?

Best, Matt

Main.xaml (13.1 KB)
Book1.xlsx (8.7 KB)

@mattsheep,
Remove duplicates in Data table 2

DT2.DefaultView.ToTable(TRUE)

Thanks~Rajesh

Hi @mattsheep, take a look at this !

And see how I’ve checked the “add headers” propertie in the read excel activities, thats important. With this check, the first row of the column is gonna be considered as the name of the column. Doing this you can easily diference the columns in a excel sheet.

Moreover, you can do: row(“Name of the column”).tostring to get the string value of the current row in that column.

See the sample, I’ve modified the Excel too.
sample.zip (9,7 KB)

Bests,
Pablo

Dear @rajeshprabhu_gp,

Thanks for your help! DT2.DefaultView.ToTable(TRUE) gives me unique values when I put the assign in the THEN column (leftside) of the IF condition.

However, when I transfer it to the ELSE column (rightside) of the IF condition, I still have double values. See the snapshot below.

Capture

I added the workflow and the Excel to this topic. Is it possible you maybe could have a quick look?

Best, Matt

Main.xaml (14.9 KB)
Book1.xlsx (8.7 KB)

@mattsheep

Main.xaml (17.5 KB)

the scenario i sampled in the attachment is to find not exist list. Please manipulate as you wanted or let me know the expected output sample.

Thanks~Rajesh

1 Like

Dear Rajesh, @rajeshprabhu_gp

This is perfect and so good, I can’t stop smiling. This is exactly what I need. Thank you!

Do you maybe know, how can I add a counter in a messagebox to see how many values are not equal? (from the example the answer would be 2)

Hope you maybe could have a look!

Best, Matt

@mattsheep

Main.xaml (19.4 KB)

Please find the attached!

Thanks~Rajesh

1 Like

Perfect @rajeshprabhu_gp, very good. I now can use it and also other robots. You explain it very simple in your workflow.

Best, Matt