Fetch word/words that got matched from the Datatable

Hi,

The below code checks complete dt word is present ArrTarget .

dt.AsEnumerable().Any(Function(r) (From val In arrTarget Where r.ItemArray.Any(Function(o) val.ToLower.Contains(o.ToString.ToLower))).Count > 0)

For example .
Dt word
order
miss
return

ArrTarget=[“Ordering” “the” “cake”]

Output is “True” .As dt contains “Order”

i need to get which word/words that got matched from the Datatable . Kindly help me to do it . I need to have an Log activity to log which word got from Dt got matched .

Hi @tharaninatarajan1901 ,

Maybe the Expression can be modified to the below :

String.Join(",",dt.AsEnumerable().Where(Function(r) arrTarget.Any(Function(o) o.ToString.ToLower.Contains(r("Word Column Name").ToString.ToLower))).Select(Function(x)x("Word Column Name").ToString).ToArray)

Instead of Word Column Name, use the column name which has the Words that you need to compare.

Also, You could use the Above Expression directly in a Log Message activity. If required as an Array, we could remove the String.Join() part and assign the Expression to an Array variable.

1 Like

Thanks a lot .It worked !

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.