Need some help in solving issue related to comparison of two datatables.
Dummy DT1 is as below:
Role
A
B
C
D
E
F
G
H
I
Administrator
Y
Y
Y
N
Y
Y
Y
Robot
N
Y
N
N
Y
Y
Y
Developer
Y
Manager
Y
Dummy DT2 is as below:
Role
A
B
C
D
E
F
G
H
I
Administrator
Y
Y
Y
N
Y
Y
Y
Y
Robot
N
N
Y
N
Y
Y
Y
Developer
N
N
Manager
Y
Condition: If any value is not matching or is not available in any of the DTs then, Value = Value_Change
For example: DT1 - Y & DT2 - N —> Output: N_Change
DT1 - Blank & DT2 - Y —> Output: Y_Change
Issue: Not able to compare cell values using two keys. As column names cannot be predefined.
Key 1: Role
Key 2: ColumnName(A to I)
Please help me on this. Any leads will be appreciated!!
(
From r1 In DT1.AsEnumerable
Let role = r1(0).ToString
Let ia2 = DT2.Rows(RoleIndxDict(role)).ItemArray
Let ra1 = r1.ItemArray.Skip(1).Select(Function (x, i) If(x.ToString.Equals(ia2(i+1).ToString), x, ia2(i+1).ToString & "_Change" )).ToArray
Let ra = ra1.Prepend(role).ToArray
Select rs = DT_Output.Rows.Add(ra)
).CopyToDataTable