03-10-2020 04:00 AM
Hello,
Newbie here. Can someone provide me an example on how to assign a value to an array? What step should i be using? I have tried Set method but there is no way to give the position of the array.
Thanks in advance.Contact Center, UCCX, Other Contact Center
03-10-2020 02:22 PM
03-11-2020 01:47 PM - edited 03-11-2020 01:56 PM
Hello,
Two questions here.
1. I am confused why the script is not getting the value of iArrayElement and throwing the following error in the get JSON document data step. When debugging it shows the value as 0. If I hard code a number then it works fine and returns the string that I am expecting.
Exception : nested exception is: \n\tcom.jayway.jsonpath.InvalidPathException: Could not parse token starting at position 40. Expected ?, ', 0-9, * "
2. @Anthony Holloway like you have mentioned I got the invalid null array error when try to set a sting to ArrManufactures. (I got to this step only when i had hard code the array element as mentioned in the first question) What is the best approach to parse the this JSON response. I was trying to loop through the response, get one value at a time and build the array.
[
"SHORETEL",
"UNSPECIFIE",
"AVAYA",
"CISCO",
"SHORETEL"
]
03-12-2020 07:52 AM
09-29-2020 01:17 AM - edited 09-29-2020 01:19 AM
I had the exact issue recently. I wanted to store a list of card numbers in a string array, which will be return as the response to a REST call. There's no way to know the number of cards belonging to a customer, to initialize the array prior. So I had to declare an array prior with a larger size.
1. debug show string as following, while executing.
2. However, I could see after get JSON document details step filling the data into array, it also gets resized into actual element count.
3. After going though your post, I assumed may be JSON data step has the same behavior as string.split. Then I removed array initialization step and kept array size undefined. During the execution, I could see array get's data accordingly.
I'm not sure how safe to use this in production environment, specially we have seen some garbage values exist when string arrays not defined properly or accessed improperly. I like to keep it this way, since it's much cleaner.
Thank you !
09-29-2020 07:23 AM
Awesome info, and thank you for sharing!
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