Join DataTable With Different Data Type

Hello,

I’m trying to solve for the most efficient answer. I have two DataTables and am performing a join on two columns. One column is Type is ‘Object’ and its comparing to ‘String’ so all joins are not executed.

I need to convert the ‘Object’ column to ‘String’ so the join is effective. I searched and it looks like I can’t change the type after the DataTable has already been populated? Am I going to have to add a new Column and add each row?

I found this post using the select statement but can’t seem to get it to work.

1 Like

@bradsterling you can change the column type of source table before joining but you may loose some data. so take care of that.

Cheer!!

1 Like

Hi @bradsterling

You can create another column with the data type you want and add the converted data to it.

Use add data table column to create a new column. Then use a for each row activity to loop through your datatable. Within the loop, use an assign activity to assign the converted value to the new column.

As you said, you cannot change the data type of the datatable column once its created. Such change will actually lose the data in the column. So the best way that I know of is to have a copy column as explained above with the required data type

2 Likes

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