1

I would like to screen scrape a few user details including the handphone no. from one application and paste the details into another application. There's a spacing in the handphone no. e.g. 8123 4567. I would like to remove the spacing and paste 81234567 into the other application.

I have use Build Data Table and Write Range to store the captured information in. In the handphone no. screen scrape activity, I did the following additional steps to split the numbers and combine them into 1. It works the first few times but when I tried running the script a few days later, it stopped working. Basically, the handphone no. is not completely copied over. Sometimes it returns as 8123 and sometimes as 812.

Assign

    ArrayHandphoneNo = HandphoneNo.Split({" "},stringsplitoptions.None)

Assign

    HandphoneNo = ArrayHandphoneNo(0)

Try Catch

    HandphoneNo = HandphoneNo + ArrayHandphoneNo(1)

    Catches exception

Assign

    HandphoneNo = HandphoneNo

May I know what went wrong?

Conor
  • 736
  • 1
  • 13
  • 33
Zahrahndom
  • 13
  • 3

1 Answers1

2

Why you having a workaround. From my perspective you simply need a line of code that is removing all spaces. So you get back the full digit number. So try with this:

myString = myString.Replace(" ", "")

in your assign activity.

Could look like this one: UiPath Studio process

kwoxer
  • 3,734
  • 4
  • 40
  • 70
  • Thank you so much for your reply. I have edited using your code but now the output showed 81234. It is still incomplete. Do you know why I encounter such issue? The settings for the name and addresses are the same as the hp no. but somehow the script does not manage to successfully paste the hp no. as 8 digits. I use the TypeInto activity. – Zahrahndom Feb 27 '20 at 01:43
  • So you have "8123 4567" as String and after processing `myString = myString.Replace(" ", "")` you just get "81234", is that correct? – kwoxer Feb 27 '20 at 06:55
  • yup that's correct. I usually get output of either 4, 5 or 6 digits but it's never complete. – Zahrahndom Feb 27 '20 at 07:58
  • I added the image and it works as intended. I assume that you have other trouble. To find your issue you should log the String variable at different times. Hope it runs now. – kwoxer Feb 27 '20 at 08:37
  • I tried doing the log message and the output is exactly like yours. Anyways, I have tried on 2 requests. The first one did not copy over all 8 digits but the second one was done successfully. So hopefully, it will work from now on. Really appreciate your help and taking the time to look into this! – Zahrahndom Feb 27 '20 at 09:18
  • No problem at all. But totally recommend you to have a look in the free UiPath Acedemy. Many tutorials there totally for free and at the end you always get good feedback. I learned there anything I need to know. =) – kwoxer Feb 27 '20 at 09:20
  • Ok I definitely will! – Zahrahndom Feb 27 '20 at 09:23