Hi Team,
Need to compare the required column values from sheet2 to sheet1
Condition: If values do not matched sheet2 values from sheet1 then throw the exception
Sheet1:
Sheet2:
please help
thanks
shaik
Hi Team,
Need to compare the required column values from sheet2 to sheet1
Condition: If values do not matched sheet2 values from sheet1 then throw the exception
Sheet1:
Sheet2:
please help
thanks
shaik
Try this workflow if you want to compare only specific columns
Not Enumerable.SequenceEqual(dt1.DefaultView.ToTable(False,{"Column1","Column2"}).AsEnumerable, dt2.DefaultView.ToTable(False,{"Column1","Column2"}).AsEnumerable, DataRowComparer.Default)
Hope this helps!
Happy automation ![]()
my values are equal but it’s going to throw the exception
please check
thanks
shaik
Hi @Sanjay_Bhat
Try this condition in If:
If
dt2.AsEnumerable().Any(Function(row2) Not dt1.AsEnumerable().Select(Function(row1) row1("E212").ToString.Trim()).Contains(row2("E214").ToString.Trim()))
Then
New Exception("Some values in Sheet2 are not present in Sheet1.")
End If
Hope it helps!!
it’s going throw the exception
please check
thank
shaik
Try this condition in If:
If
Not dt2.AsEnumerable().All(Function(r2) dt1.AsEnumerable().Any(Function(r1) r1("E212").ToString = r2("E212").ToString AndAlso r1("E214").ToString = r2("E214").ToString))
Then
New Exception("One or more rows in dt2 not found in dt1.")
End If
Hope it helps!!
Thank you @Parvathy logic working fine
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.