IndexOf in Client security Assignment

Hi, I’ve been working on the client security assignment, in the extract client Information workflow, I have inputted the assign with the IndexOf (“Client ID”) yet I get the error index was out of bounds of the array.Anyone with the solution should please help

Hi @RPA-botDev,

Are you using substring method ? i think your script should like this IndexOf("Client ID: ")

Regards.

No, I used this: ClientInformation.Substring(ClientInformation.IndexOf("Client ID: ")+"Client ID: ".Length).Split(Environment.NewLine.ToCharArray)(0)

can you show the result from get text activity ?

Not that. I mean the output from ClientInformation. You can use writeline or log message activity

Regards

GTout

Consider, ClientInfo = contains all the client info (recorded from studio)

First divide client info into array -

arrClient = Split(ClientInfo,Environment.NewLine)

Extract the individual values -

Out_ClientId = arrClient(0).Replace("Client ID:","").Trim
Out_ClientName = arrClient(1).Replace("Client Name:","").Trim
Out_ClientCountry = arrClient(2).Replace("Client Country:","").Trim

@RPA-botDev,

Put space between Client and ID and try. And also write IndexOf("Client ID: ")

Still the same issue, I am also getting the message cannot find the element corresponding to the attach browser of the work Item details page. I have tried debugging severally it seems the page is not opening

It’s working now

@KarthikByggari, it worked, please can you tell me why the indexOf didn’t work because I used your splitArray method and it worked

You have to split by NewLine, but not ToCharArray.

So your array contains each character in one element and finding client Id will fail.

For example,

yourarray = {“C”,“l”,“i”,…}

If you are trying to find client id: in a single element. So it is failing.

That means substring is not preferrable.Please when am I to use TocharArray

There is a small mistake in your expression. First you have to split the client information by new line and then look for client id, name and country.

@KarthikByggari, I will like to know why Client ID replaced with " ," in your expression

Sorry for delay.

My array will look like below -

For example:

arrClient(0) = “Client ID: 12346”

When I do replace with "Client ID: " with empty, I will get 123456 which is the required one.

Regards,
Karthik Byggari

Thanks for clarification, I ran into a similar problem though. I am using get text to retrieve the email from the site, but it happens that it got the email and the text below it and I want to insert only the email to the Excel sheet.So is it better to also use split method or is there a better way of getting only the email without the text

You can use regular expression to extract the mail id from text.

Please can you illustrate to me how to use it, also I searched for it in the activity panel and can’t find regex activity