Join two datatables excel

Hello friends I am trying to join two data tables and put it in another sheet but it writes me blank

this is my first and main table
image

and this is the second one where I have to look for the data according to the “FACTURA” column, and paste only invoice and folio on the sheet Hoja4

and this is my code, I also attach the excel and my .xaml


Main.xaml (8.8 KB)
Facturas combustible.xlsx (113.6 KB)

I hope you can help me, I don’t know what to do anymore

Hi @Ivan_torres_oliva.

The reason for getting the empty datatable at output is the following.

Here when u are joining two datatables by join datatable activity. It will join the datatable based on following condition Factura of Hoja1 = Factura of Hoja2.
But if you closely look at the excel file the datatype of FACTURA in Hoja2 and Hoja1 are different.

in Hoja2, FACTURA column datatype is in Number format.

image

in Hoja1, FACTURA column datatype is in text (String) format. So you can see a warning symbol in FACTURA column of Hoja1.

So in join datatable when we are comparing two column values one is in Number datatype and other is in text datatype (String). Since we can’t compare String with Number directly. we need to convert the Number to String or String to Number so as to compare the both columns.

So i was thinking to convert the FACTURA column of both sheets into common datatype so that we can compare it via join datatable activity.

So at first i thought FACTURA Column has only Numerical datataype as per information in Hoja2 sheet. But when looked into Hoja1 sheet, it was found that apart from the Numerical datataype FACTURA column value, there are some alphanumeric values also there (screenshot below)

So it was better to convert the FACTURA Column of both sheet into String Datatype.

So in the first part of the workflow, there is sequence which convert the datatype of FACTURA column of Hoja2 sheet from Numerical to String.

Rest is the same way as u had did

Refer Workflow : Main.xaml (12.2 KB)

I tested it and it works fine. Output i got

Please Note:
While comparing values between columns/ Between sheets make sure that values you are comparing should be in same datatype, otherwise it will not be equal even if values are same

Hope this helps you

Regards

Nived N

Happy Automation​:robot::robot::robot::robot::robot:

Hello friend, thank you very much change all the format to pure text so that they are the same and it works without problems, thanks

1 Like

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