I’m using a for each row activity to iterate through a datatable and then use a matches activity.
I want to check if we can have an expression like-
$row.item(1) ?
Hi,
Your expression seems incomplete. Can you share your requirement in detail using preformatted text ( the above </>
button)?
Regards,
Hi @Yoichi
I’m using 2 datatables,
I iterate the datatable 1 using the for each row to get the words.
Now let’s assume the first word is more. i want to check if the word more Is present in datatable2. For this I’m using a filter activity.
The issue is:
Say example in datatable2
Column1
Evenmore
Evermore
More
Is it more
I want get the desired output as
Column1
More
Is it more
Is It possible?
Hi,
Can you try the following regex pattern with IgnoreCase option?
\bmore\b
if you want to handle keyword as dynamic, the following might help you.
"\b"+System.Text.RegularExpressions.Regex.Escape(strVar)+"\b"
Regards,
@Yoichi ,
I’m aware the if the regex, but curious if this can be used along with a linq query.
Can it be used?
Hi,
Which type do you need as result, string array, datarow array or datatable?
If string array, the following will work.
arrString = dt2.AsEnumerable.Where(Function(r) System.Text.RegularExpressions.Regex.IsMatch(r("Column1").ToString,"\b"+System.Text.RegularExpressions.Regex.Escape(strKeyword)+"\b")).Select(Function(r) r("Column1").ToString).ToArray
Regards,
(From d2 in dt2.AsEnumerable
Let chk = dt1.AsEnumerable.Any(Function (d1) YOURLAMBDAEXRPESSION_returningBool)
Where chk
Select r=d2).CopyToDataTable
Above initial pattern can be extended on the check e.g. done with a regex ismatch or others
Hi,
FYI, the expression will be as the following. (I added ignorecase option, too)
dt2.AsEnumerable.Where(Function(r) System.Text.RegularExpressions.Regex.IsMatch(r("Column1").ToString,"\b"+System.Text.RegularExpressions.Regex.Escape(strKeyword)+"\b",System.Text.RegularExpressions.RegexOptions.IgnoreCase)).CopyToDataTable
Regards,
@Yoichi
Here the strkeyword is of type string for an array of keyword string we’ll have to apply a for each Loop?
Solution:
I wrote another linq query to get the unique items for keywords.
And then used it in the above linq.
Thanks @Yoichi @ppr
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.