[DataRowComparer] maybe more simple.
Here is my code.
comparing-two-datatables.zip (10.0 KB)
@lainh hi,
you have to do it with a for each row inside of another for each row.
For example:
Call the rows of the first for each → row
Call the rows of the second for each → line
Then, you can check the values using:
if(row(“The name of your column”).toString <> line(“The name of your column”).toString)
→ writeLine : “We have a dismatch”
I hope it can help you, I guess it is easy to understand.
Bests,
Pablo
I did what you said in the [invoke code] activity with different method.
You can check the xaml flle on [invoke code].
My way is
- use [DataRowComparer] to found if the tow rows are different
- to compare the columns of the datarow above to find which pair of cells is unmatched in loop.
@lainh I’m sorry… I don’t have so much time now… so much work to do
If I have time I will check the .xaml, I hope you will get help before as I will be able to check it
Bests,
Pablo
Hi Pablo,
Thanks for your reply!
I have used the same logic in my work flow.
Hi Gaurav,
I have attached the comparison logic workflow. Kindly let me know if you got struck somewhere.
Thanks and regards,
Ananthu
Comparison logic.xaml (22.3 KB)
Dear @Ananthu
I tried to use your Comparison logic.xaml file.However, when process comes to Assign counter=counter+1 I got message:
Object reference not set to an instance of an object. This error usually occurs using a variable with not set value (not initialized).
I will appreciate if you can explain how to fix it.
test1.xlsx (16.6 KB)
DD.xaml (24.1 KB)
In the finale I want to get 3 rows on the sheet C which contains differences…
Thank you for the advice and help!
Hi @Aggi ,
Just initialize the counter variable with 0. That should resolve your issue.
Kindly let me know if you face any other issues.
Thanks and regards,
Ananthu
Dear @Ananthu,
would you be so kind to explain me some problem with code. I use it and I got mistake…it is count every second column of the table (not each) AExample.xaml (31.8 KB)
test1.xlsx (17.4 KB)
Hi @Aggi,
The problem with your test1 excel sheet is that it haven’t got any unique element to map across sheets for comparison.
In the attached workflow, I have used the row index as unique element and did the comparison. Kindly let me know if you face any issues.
AExample.xaml (34.9 KB)
Thanks and regards,
Ananthu
Hi @Ananthu,
thank you for help. I understand now everything clear -)
Have a nice weekend.
Agata
Have a great weekend!
Hi Ananthu,
I am stuck in a similar problem…
I have two data tables, one contains the names, another datatable contains another set of names, i just need to check if the name in dt1 is present in dt2.
can you please help me?EXCELanasys.xaml (35.2 KB)
Hi shreyaank,
Ya sure! I will send you the workflow by tomorrow…
Thanks and regards,
Ananthu
Hi @shreyaank,
I have verified your work flow. You have to initialize the variable i to 0. If you still have issues, kindly send me the excel sheet so that I could verify.
Thanks and regards,
Ananthu