cancel
Showing results for 
Search instead for 
Did you mean: 

How can I extract a text and then the number from it

Anonymous
Not applicable

I'm trying to extract a confirmation text from confirming window, and I tried many ways but the only text I get is "Order Confirmed" not the body text 

so how to get the body and then the number?

32651.jpg


Thanks in Advance 



------------------------------
Sanaa Fallah
------------------------------
1 BEST ANSWER

Helpful Answers

Hi Sanaa,

You can spy the element by choosing the below attributes by spying in AA (Active Accessibility) mode and then use the 'Get Name' action within the read stage to get the required value into a data item called 'Order Text' let say:

32642.png

32643.png

Once you retrieve this value use a calculation stage with the given expression and store it in a data item called 'Order Number' as shown below:

32644.png

Expression is : Trim(Mid([Order Text], InStr([Order Text], ":")+1 , Len([Order Text]) - InStr([Order Text], ":")))

Let's try to break this and understand how this works:

InStr([Order Text], ":")+1 : This part of the expression returns us the index of one position greater that the colon character in the text ":". We are adding one to the index so that the next expression where we are going to use Mid Operator can start extracting value after colon.

Len([Order Text]) - InStr([Order Text], ":"): This returns us the length of the characters to be extracted. Here I am taking the total length of my text and subtracting the length of text before and including the colon character as we need to extract the words after that colon.

Mid([Order Text], InStr([Order Text], ":")+1 , Len([Order Text]) - InStr([Order Text], ":")): This complete expression that uses mid will now be able to take the above two formulas and return me the entire text starting after colon.

At the end, I am enclosing the above formula within a Trim function so that I can remove any unnecessary spaces that might get extracted as well.

In the end your workflow will look something like this:

32646.png

------------------------------
----------------------------------
Hope it helps you and if it resolves you query please mark it as the best answer so that others having the same problem can track the answer easily

Regards,
Devneet Mohanty
Intelligent Process Automation Consultant | Sr. Consultant - Automation Developer,
Wonderbotz India Pvt. Ltd.
Blue Prism Community MVP | Blue Prism 7x Certified Professional
Website: https://devneet.github.io/
Email: devneetmohanty07@gmail.com

----------------------------------
------------------------------
---------------------------------------------------------------------------------------------------------------------------------------
Hope this helps you out and if so, please mark the current thread as the 'Answer', so others can refer to the same for reference in future.
Regards,
Devneet Mohanty,
SS&C Blueprism Community MVP 2024,
Automation Architect,
Wonderbotz India Pvt. Ltd.

View answer in original post

3 REPLIES 3

Hi Sanaa,

You can spy the element by choosing the below attributes by spying in AA (Active Accessibility) mode and then use the 'Get Name' action within the read stage to get the required value into a data item called 'Order Text' let say:

32642.png

32643.png

Once you retrieve this value use a calculation stage with the given expression and store it in a data item called 'Order Number' as shown below:

32644.png

Expression is : Trim(Mid([Order Text], InStr([Order Text], ":")+1 , Len([Order Text]) - InStr([Order Text], ":")))

Let's try to break this and understand how this works:

InStr([Order Text], ":")+1 : This part of the expression returns us the index of one position greater that the colon character in the text ":". We are adding one to the index so that the next expression where we are going to use Mid Operator can start extracting value after colon.

Len([Order Text]) - InStr([Order Text], ":"): This returns us the length of the characters to be extracted. Here I am taking the total length of my text and subtracting the length of text before and including the colon character as we need to extract the words after that colon.

Mid([Order Text], InStr([Order Text], ":")+1 , Len([Order Text]) - InStr([Order Text], ":")): This complete expression that uses mid will now be able to take the above two formulas and return me the entire text starting after colon.

At the end, I am enclosing the above formula within a Trim function so that I can remove any unnecessary spaces that might get extracted as well.

In the end your workflow will look something like this:

32646.png

------------------------------
----------------------------------
Hope it helps you and if it resolves you query please mark it as the best answer so that others having the same problem can track the answer easily

Regards,
Devneet Mohanty
Intelligent Process Automation Consultant | Sr. Consultant - Automation Developer,
Wonderbotz India Pvt. Ltd.
Blue Prism Community MVP | Blue Prism 7x Certified Professional
Website: https://devneet.github.io/
Email: devneetmohanty07@gmail.com

----------------------------------
------------------------------
---------------------------------------------------------------------------------------------------------------------------------------
Hope this helps you out and if so, please mark the current thread as the 'Answer', so others can refer to the same for reference in future.
Regards,
Devneet Mohanty,
SS&C Blueprism Community MVP 2024,
Automation Architect,
Wonderbotz India Pvt. Ltd.

John__Carter
Staff
Staff
Hi Sanna - Devneet is right in that you need to get the text from the label itself, rather than the popup window. But there is a simpler way of extracting the number:

Replace([Order Text], "Please make a note of our reference number: ", "")

------------------------------
John Carter
Professional Services
Blue Prism
------------------------------

Anonymous
Not applicable
Thank you John, it also works 


------------------------------
Sanaa Fallah
------------------------------