’ Assuming dt1 and dt2 are the two DataTables to be compared
use this Linq
From row1 In dt1.AsEnumerable()
From row2 In dt2.AsEnumerable()
Where row1.Field(Of String)(“Column1”).Contains(row2.Field(Of String)(“Column2”))
Select New With {
.Column1 = row1.Field(Of String)(“Column1”),
.Column2 = row2.Field(Of String)(“Column2”)
}
Hi @sophiey ,
we have 2 popular ways are
1.use activity ‘for each row’ dt1 inside ‘for each row’ dt2
and ‘if’ row = line
→ assign value result
2.use linq
regards,
Hi @sophiey ,
Thanks for reaching out to UiPath Community.
You can try these steps to achieve the solution you need.
Create a new DataTable result to store the comparison results.
Use For Each Row loops for both DataTables:
For each row in dt1, you will iterate through each row in dt2 to compare them.
Perform Partial Matching:
For each row in dt1, iterate through each row in dt2 and compare the values. You can use string methods like Contains, IndexOf, or regular expressions to check for partial matches.
Add a Row to result DataTable:
When a match is found, add a row to the result DataTable with the corresponding values and match status.
Let us know if it fails for any of the sample test strings and do provide us the failing strings so that we can correct the logic if needed.
The Logic used is - The Length of the String could be taken into consideration to identify the shortest length string, Then We would need to check whether all the words of the shortest string exist in the Other String and if so, it counts as a Match else Not Match.
Note: Here case insensitive is considered when comparing strings.