12-24-2019 08:03 AM
Hello Experts,
I am trying to read an XML file which contains some Area Codes in order to route the calls either localy or long distance. Please see the attached screenshot and let me know if I am missing something.
Thanks,
MK
Solved! Go to Solution.
01-08-2020 06:32 PM
MK:
I reviewed the photo you uploaded... The error is occurring because of a mismatch of the named variables being used.
In the solution provided, these have been changed in your image and do not match:
Look closely in yours, again, and you will see why.
...working with named variables that have similar spelling, can create this kind of confusion if you don't keep a close eye on what is being assigned, and where.
In the sample above, the callback number variable is being used with the substring function to select the area code from the string. That resultant string is being used to search the document data as part of the XPath string in the next step. In your pic, you are using a different named variable than the one in the previous step.
Watch-out, because the next step in your pic has the same issue. It will not evaluate properly, because of an incorrectly assigned named variable.
Hope this helps.
-Sean
12-26-2019 07:30 AM - edited 12-26-2019 05:52 PM
I believe the problem exists in the format/syntax of your XPath expression you are attempting to use in the "Get XML Data" steps:
In my sample solution, I've created 3 document data variables to show various ways to script the XPath value; variables below:
In the sample solution below, it executes 3 Get XML Document Data steps against your XML Document and reads for the same value; all in different ways (Static with predicates, shorted with predicates, and shortened with an integer variable for the same):
(the last Get XML Document Data step uses variables as shown assigned before the step executes)
Here's the sample output for the zip code found at item#545 using all three methods:
I hope these examples help show the difference in XPath syntax.
-Sean
01-03-2020 08:48 AM
01-03-2020 01:07 PM - edited 01-03-2020 01:33 PM
Hmmm... Okay. Now I see what you were attempting.
This is how I was able to evaluate that long list of AreaCodes using the Short method. Sample pic:
I set the xpath variable to: "//AreaCode[AreaCode=" + sAreaCode + "]"
The String variable returned is actually not useful. It's the 'null' expression you want to evaluate (area code not found is returned as 'null').
Variables used in the Sample:
...what I learned in this exercise is that XPath in UCCX does not allow Boolean expressions to be returned/evaluated:
//AreaCode/AreaCode=343202 == true
...UCCX doesn't like this.
Let me know if this helps.
-Sean
01-08-2020 07:58 AM
01-08-2020 06:32 PM
MK:
I reviewed the photo you uploaded... The error is occurring because of a mismatch of the named variables being used.
In the solution provided, these have been changed in your image and do not match:
Look closely in yours, again, and you will see why.
...working with named variables that have similar spelling, can create this kind of confusion if you don't keep a close eye on what is being assigned, and where.
In the sample above, the callback number variable is being used with the substring function to select the area code from the string. That resultant string is being used to search the document data as part of the XPath string in the next step. In your pic, you are using a different named variable than the one in the previous step.
Watch-out, because the next step in your pic has the same issue. It will not evaluate properly, because of an incorrectly assigned named variable.
Hope this helps.
-Sean
01-09-2020 09:53 AM
Sean,
That was exactely my mistake.
Thank you very much, I appreciate your help.
MK
01-12-2020 09:12 AM
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