Nisha_K21
(Nisha)
1
Hi,
I have one excel that I’m going to upload it into orchestrator queue:
Then I wanted to check in the column “place” if it has a value “pune” or not.
We can do this with Contains keyword but is there any alternative way to do this?
Thanks in advance
lrtetala
(Lakshman Reddy)
2
Hi @Nisha_K21
Can you try this
FinalDT = InputDT.AsEnumerable().Where(Function(row) row("Place").ToString.Split(","c).Any(Function(place) place.Trim().Equals("pune", StringComparison.OrdinalIgnoreCase))).CopyToDataTable
Regards,
Nisha_K21
(Nisha)
3
@lrtetala ,
Suppose if these data is placed in orchestrator queue, How can I validate that?
lrtetala
(Lakshman Reddy)
4
@Nisha_K21
isPunePresent = in_TransactionItem.SpecificContent(“Place”).ToString.Split(","c).Any(Function(place) place.Trim().Equals(“pune”, StringComparison.OrdinalIgnoreCase))
If isPunePresent
’ Pune is present
Else
’ Pune is not present
End If
Regards,
Nisha_K21
(Nisha)
5
@lrtetala Thanks for the response
Is it possible to do that without using LINQ?
Gowtham_K115
(Gowtham Krishnan)
6
Hi @Nisha_K21
You can try this way without Linq,
in_TransactionItem.SpecificContent("place").ToString.Trim.ToUpper.Contains("PUNE")

Regards,
Gowtham K
Nisha_K21
(Nisha)
7
@Gowtham_K115 ,
I tried this method it worked but I wanted to check with alternative of contains keyword.
Do we have alternative method for this?
lrtetala
(Lakshman Reddy)
8
@Nisha_K21
Array_Place = in_TransactionItem.SpecificContent(“Place”).ToString.Split(","c)
For Each place In Array_Place
If place.Trim().Equals("pune", StringComparison.OrdinalIgnoreCase) Then
Pune is Present
Else
Pune is Not Present
End If
Regards,
Gowtham_K115
(Gowtham Krishnan)
9
@Nisha_K21
You can try this,
System.Text.RegularExpressions.Regex.IsMatch(in_TransactionItem.SpecificContent("place").ToString.Trim.ToUpper, "\bPUNE\b")
Regards
Gowtham K
You can use IndexOf method and check if is result is >= 0. Why don’t you like Contains though? It’s the best for this case.