Hi All,
I want to compare all the columns of two DataTable DT1 and DT2 Column Values using LINQ query and find out the column values which are matching and the column values which are not matching and output the unmatched column values in another DataTable. Need to remove any special characters in column values and check for exact match .
Salesforce_Output.xlsx (6.8 KB)
Results.xlsx (8.5 KB)
mkankatala
(Mahesh Kankatala)
March 7, 2024, 5:12am
2
Hi @marina.dutta
Do you want to compare all columns or any specific columns. Could you be more specific…?
@mkankatala
I want to compare all the columns
gRao
March 7, 2024, 7:18am
5
Hi @marina.dutta ,
Try this out
You have to try this for all columns:
Match:
Results File Master and Salesforce File Child
Convert Each Col Values to array:
ArrVarOne=(From row In dt_Results.AsEnumerable() Select Convert.Tostring(row(0)) ).ToArray()
ArrVarTwo=(From row In dt_Salesforce.AsEnumerable() Select Convert.Tostring(row(0)) ).ToArray()
Matching Values in 1st col of both files:
ArrMatch=ArrVarOne.Intersect(ArrVarTwo).ToArray
Values in 1st col of Result file Missing in 1st col of Salesforce file:
ArrMisMatch=ArrVarOne.Except(ArrVarTwo).ToArray
Values in 1st col of Salesforce file Missing in 1st col of Result file:
ArrMisMatch=ArrVarTwo.Except(ArrVarOne).ToArray
@gRao
I need to compare the column values between two data tables and filter out unmatch columns and get those column values in third sheet.
@gRao
I used this query but getting entire rows along with unmatched columns
(From d In DT1.AsEnumerable
Let k1 = d(“QuoteNumber”).ToString.Trim
Let k2 = d(“StartDate”).ToString.Trim
Let k3 = d(“PaymentTerms”).ToString.Trim
Let k4 = d(“Total Contract Value”).ToString.Trim
Let k5 = d(“Primary Contact”).ToString.Trim
Let k6 = d(“Scheduling & Delivery”).ToString.Trim
Let k7 = d(“EndDate”).ToString.Trim
Where Not DT2.AsEnumerable.Any(Function(d2) d2(“QuoteNumber”).ToString.Trim.Equals(k1) AndAlso d2(“StartDate”).ToString.Trim.Equals(k2) AndAlso d2(“PaymentTerms”).ToString.Trim.Equals(k3) AndAlso d2(“Total Contract Value”).ToString.Trim.Equals(k4) AndAlso d2(“Primary Contact”).ToString.Trim.Equals(k5) AndAlso d2(“Scheduling & Delivery”).ToString.Trim.Equals(k6) AndAlso d2(“EndDate”).ToString.Trim.Equals(k7))
Select r = d).CopyToDataTable
I just want to update the unmatch columns in another sheet.Yellow are my unmatched columns .I just want these two columns not entire and copy to another data table
gRao
March 9, 2024, 11:44am
8
Hi…
If ur requirement is find the columns not present then…
Follow this post…u ll get the column names present in Excel one that are not present in second excel…
https://www.linkedin.com/posts/geetishree-rao-6968521b_uipath-rpa-excelautomation-activity-7044949750223179776-LDp-?utm_source=share&utm_medium=member_android
system
(system)
Closed
March 25, 2024, 7:43am
10
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.