Skip to Content
0
May 29, 2020 at 06:54 AM

Intelligent RPA Extract number from text

721 Views

Hi all,

Basically I've currently extracted a message from an SAP status bar and stored it to a context item.

The text extracted is like this: "Order Number 124563 has been created"

Now I'm looking to get just the number from that string so I looked up online and found the ctx.string library from contextor and tried using this to extract the number

Code in custom activity:

ctx.string.init();

rootData.StatusBar.soNumber = ctx.string.integerPart(rootData.StatusBar.statusBar);

ctx.string.end();

ctx.log(rootData.StatusBar.soNumber);

But the log doesn't output anything so I'm assuming I haven't got the number extracted. Does anyone have any experience on using this library and could maybe tell me what I'm doing wrong? I don't have much experience so apologies in advance but any help would be appreciated! Thanks!