Hi All,
I am trying to convert ‘825 Holidays found’ to just ‘825’ but that variable is dynamic so have tried using regex expressions but not sure what variable type and how to change it to int
Hi All,
I am trying to convert ‘825 Holidays found’ to just ‘825’ but that variable is dynamic so have tried using regex expressions but not sure what variable type and how to change it to int
Hey @Stabbathehut
You can use Matches Activity – Which searches an input string for all occurrences of a regular expression and returns all the successful matches.
Input - “825 Holidays found”
Pattern - “^\d+”
RegexOption - IgnoreCase(Select From drop down)
Result - you will get collection of found matches. from this collection take first value by index 0. Ex: Result_collection(0) ==> this will give your value.
If you are getting data in the same format like digits come in first then use split method with space as delimiter then get first element by index 0.
Hope this helps you.
Regards,
Vijay.
Hi Vijay, how do I convert the resultant to an integer?
@Stabbathehut
numbers as strings can be converted to integer eg. with CInt(yourNumberString)
But the resultant is not a string? It returns as an IEnumerable.
@Stabbathehut
In some cases the holiday count can be grabbed seperated as it is a span with the classname holiday-count
<webctrl tag='SPAN' class='holiday-count' />
find a starter help here, but rewire the window selector
Stabbathehut_HolidaysCount.xaml (5.2 KB)
in case of doing it with a matches activity:
Hey @Stabbathehut
After getting result from collection use CInt() - to convert it into integer value.
Ex: Int_Holidays = CInt(Result_collection(0).toString)
Hope this helps you.
Regards,
Vijay.