02-15-2014 08:05 AM - edited 03-15-2019 05:57 AM
I cannot use the Substring function to obtain a specific value from a string variable.
My substring position is variable, so I need to put a variable, loop and increment it the position.
When I try to add the below command, this is getting the error message:
Command: set STR_Resultado = STR_Valor.substring(P1,2+1)
Error message:
"Unable to parse expression; error while parsing string: STR_Valor.substring(P1,P2); nested exception is java.lang.NullPointerException"
02-15-2014 02:05 PM
Most likely the first bullet though...
PS- You may want to get the length of the string first and ensure that the startIndex and endIndex are less than or equal to it. I believe you'll get a IndexOutOfBoundsException if you try to pull a substring from outside the bounds of the actual string.
Please remember to rate helpful responses and identify helpful or correct answers.
02-17-2014 11:32 AM
Hi Jonathan, how are doing?
Which exception I will choose for this case?
Thank you
02-17-2014 01:02 PM
I am going to guess one of two things is happening, but keep in mind, none of us have seen your script yet.
And as a remote possibility: you are using UCCX Standard, but I think the step would still be allowed during design mode, you just wouldn't be able to run the script.
Anthony Holloway
Please use the star ratings to help drive great content to the top of searches.
02-17-2014 01:31 PM
02-17-2014 01:45 PM
Worked for me. I even Active Debugged it all the way through the string as seen below.
Try a different computer+editor? Reinstall the one you're using? Are you using a supported OS for the editor?
Compatibility guide:
Anthony Holloway
Please use the star ratings to help drive great content to the top of searches.
02-17-2014 02:28 PM
I have tried from another PC and got the same problem. I also reinstalled the application on my PC and doesn't work.
Error message:
"Unable to parse expression; error while parsing string: STR_Valor.substring(P1,P2); nested exception is java.lang.NullPointerException"
02-18-2014 12:55 AM
Jefferson, can you please post a screenshot of that script while doing reactive debugging. I just want to take a look at the actual values of the STR_Valor, P1 and P2 variables, if this is possible.
Thanks.
G.
02-18-2014 07:56 AM
I thought the same thing too, but this is what he said:
When I try to add the below command...
Which to me, means that he's trying to configure the script and not even able to run it. But good question though, because he may have just chose the wrong words.
Anthony Holloway
Please use the star ratings to help drive great content to the top of searches.
02-18-2014 08:06 AM
Hi, oh, silly me. Now I see.
Jefferson, can you please post the window of that Set step when trying to add the above expression?
G.
Sent from Cisco Technical Support Android App
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide