Join Data Table Not Matching

I am attempting to do a left join on two data tables with two differently named columns. There is definitely a matching row but it is not appearing in the results. I have tried to use trim to eliminate any whitespace concerns but it has not helped. Does anyone have any other ideas?

Thanks

image

@jpreziuso

Can you share some sample data what you are trying to achieve?

Thanks,
Srini

Hi @jpreziuso

Please check whether the data type from both column are same as well. If one is of type System.String & another one is of type System.Object, you might face some challenges like this.

This often happens when one table gets the data from an excel file & another has the source from a csv file.

Hope this helps,
Best Regards.

1 Like

Hi @arjunshenoy

One of the tables is coming from excel and the other is coming from the results of a query, so this is possible. How do I check the data types of the columns, in the excel file or in UiPath?

Thanks

@jpreziuso

In UiPath, you can debug the process & access the immediate panel to verify the data type of each columns one by one. You can use the following expression for this:

yourDt.Columns(0).DataType - This will give you the datatype of the first column. Similarly, you can just increment the index number parameter to check other columns as well.

Please check the same & let us know.
Best Regards.

Thank you. I’ve determined that one column is System.Object and the other is System.String. Is there an easy way to convert the object data type to string?

1 Like

@jpreziuso

Well, in that case, you need to bring any one of the data table columns to the other data table’s column data type, so that both will match. It’s better to convert the data table columns which are System.Object into System.String columns.

To do so, You need to add columns of data type System.String to the existing data table & load whatever data is there in the corresponding column. Let’s say you have a data table dt1 with one column col1 (of type System.Object), you can add another column next to it called col2 & load the data to it from col1. You can do it like this:

Once you load the data to the System.String column, you now have a data table with unwanted System.Object column as well. You can remove the same by using the following expression in Assign activity:

dt1 = dt1.DefaultView.ToTable(False,"col2") - This will remove the col1 & keeps the col2. By this way now your data table is changed to the desired data type. You need to do this on all columns.

Hope this helps,
Best Regards.

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