Hi team,
I have got the number of employees names with get text activity and now I want to get the employees names that starts with letters S and J.
Can u please help me with this asap.
Hi team,
I have got the number of employees names with get text activity and now I want to get the employees names that starts with letters S and J.
Can u please help me with this asap.
can you share the sample output of get text activity
Try with Assign activity
Getext_val.StartsWith("S")
Or you can try with Regular expression
Pattern : \b[SsJ]\w+\b|\b[JjJ]\w+\b
Result: MatchesCollection
For Each - TypeArgument: System.Text.RegularExpressions.Match
Log Message - Message: item.Value

Regards
Gokul
Hii @Bhagyashree_S
Try this Linq Query
(
From row In DT
Let a = If(row(“Column Name”).tostring.startswith(“S”),“Yes”,“No”)
Select dt1.Rows.Add(row(“ColumnName”),a)
).copytodatatable
You can try with single Regex expression
\b[S|s]\w+|\b[J|j]\w+
Refer this
Use a assign activity and get all the matches that starts with S and J like this
str_matches = System.Text.RegularExpressions.Regex.Matches(Strinput.ToString, “\b[S|s]\w+|\b[J|j]\w+”)
Hope this helps
Cheers @Bhagyashree_S
Employees details I have taken from ACME UiPath
Hi @Gokul001
I have used assign activity and used G1.startswith(“S”)
But it’s says disallow implicit conversation from boolen to string.
you need to use it in if activity
stroutput.startswith(“S”) or stroutput.startswith(“J”) because it gives boolean output
try this :
employeeNames= {“sandeep” ,“john”}
desired_Names = employeeNames.Where(Function(name) name.StartsWith("S") Or name.StartsWith("J")).ToList()
cheers…!
I have used in if activity and I want to put it in log message
Did this method help you out using Regex
Where str_matches is a variable of type IEnumerable<System.Text.RegularExpressions.Match>
Cheers @Bhagyashree_S
Have you check out this method @Bhagyashree_S
You can try this
Use if conditon with currentRow("ColumnName").ToString.Trim.ToUpper.StartsWith("S") Or currentRow("ColumnName").ToString.Trim.ToUpper.StartsWith("J")
this if in dattable
if in get text a string …then in selector we can use a regex to get only values startign with S or J
<webctrl tag='DIV' innertext='(S|J).*' matching:innertext='regex' />
cheers
Yes I have used log message and passed G1 as variable …G1 is the output of get text activity.
But when I try to run th bot is running but not displaying anything and it’s ending
Hi nikhi
I am using acme UiPath test url and getting employee details… currently I can’t send u the screenshot
I will try but now I see that with get text activity its taking only employees name not all…the url i have used to extract employees details is ACME System 1 - Employees
Yeah I have tried with this but it’s not displaying…after if condition why u have used click…we can use just get text right?