How to compare 2 datatable where one datatable have same name for multiple columns
You can address DataTables either by its name or index:
or for your case:
columnIndex(Int32) 0 gives you the first column, 1 the 2nd column…regardless of its name.
I have to match all column name and column values from DT1 to DT2 and write as final DT with matching or mismatching!!
I have unchecked the add headers in read range of DT2, because there were multiple columns of same name, Therefore column name of DT2 came as “Column1”, “Column2” and so on…
can u help with it
It’s not quite clear how your initial datatables are structured or where they originally come from.
From Excel or in UiPath?
Nevertheless I created 2 datatables in Excel and processed them into a DT_3
For Place and Street you just copy the same IF Block and change the ItemArray values like in the City and Country Block.
You seen to have a larger DT2 so I made DT2 > Check if row in DT1 exists > If not then output “Missing”. This seems to fit your visual example.
For Place and Street connect the ItemArray(index) values as you need them.
row(indexRow).ItemArray(0) --> 1st Column of DT2
row(indexRow).ItemArray(1) --> 2nd Column of DT2
Hope this helps.
DTCompare.zip (14.1 KB)