Compare 2 data and find the differences

using the build data table activity, i have data inside which is show below
Data Table 1 (dt1):

ID Name Age
1 Alice 30
2 Bob 25
3 Charlie 35
4 Diana 40

Data Table 2 (dt2):

UserID FullName Age
2 Bob 25
3 Charlie 35
5 Eva 28
6 Frank 33

im trying to change the column name to be the same as the first data table but i have ecnounted an error, can yall show me how to do the steps from the start

Hi @Ryan_Lee

Try this way

In Save to: dt1.Columns(“ID”).ColumnName
and in value to save keep “UserID”
Hope this helps

@Ryan_Lee,

Follow this approach:

  1. Iterate through dt1 Columns using For Each activity. assign a index variable to it.

  1. Add one Assign activity inside For Each like this
dt2.Columns(intColumnIndex).ColumnName = currentItem.ColumnName

That’s it. It will change the column names of the dt2 same as dt1

how do i solve this error

@Ryan_Lee,

Argument type of the For Each might not be selected correctly. It should be like this.

its correct tho

@Ryan_Lee,

You put the Save to as dt2.Columns(intColumnIndex).ColumnName right? Hover over it and show once.

@Ryan_Lee,

Ok not sure what’s wrong but refer this code:

DtTestCode.zip (149.7 KB)

Output:
Red are before and Green one are after!

how do u find this output

@Ryan_Lee,

It’s from Immediate Panel. Learning resource here!

Kindly close the thread by marking my answer as solution so it will be helpful to other members as well.
Cheers!! :slight_smile:

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