01-28-2022 08:20 AM
Hello, I am looking for help with taking 10-20 4-digit numbers and putting them in a variable that I can use to valid if a number is in the list. I have ~60 4-digit # Triggers coming into my script and I need to compare the called number/trigger with a list of numbers and return say True if it exists in the list and False if it does not. The company that is asking me to set this up currently uses If/then statements for every comparison which makes for a lot of code. I assume there has to be a much easier way to do this?
I know there is a way to put the numbers in a document to do this and if that is the only way - please share how I'd parse the document. But I'm really hoping there is a way to define the list within the script itself.
UCCX version: 12.0
Thank you.
Solved! Go to Solution.
01-28-2022 06:10 PM
01-28-2022 09:53 AM
I would lean towards storing the info in an XML document in CCX document store. It would be a pretty simple Xquery to parse that list. Then you could update the document without having to update the script. You also wouldn't have a limit of how many numbers you could store. It may be pessimistic, but my experience is that whatever X is for the maximum number of values always has to try and find a way to accommodate X + 1.
01-28-2022 02:18 PM
Hi Elliot, could you share the code to parse the list into a variable? Here is what I tested today and works but would be better to populate the variable from the XML file for the reasons you stated. Also, would the data in xml file be by row seperated by csv or by column?
01-29-2022 12:04 AM - edited 01-29-2022 12:04 AM
The data in the XML would be stored in rows, multiple, where each value is put into an xml tag. That’s how you then form the xpath to find the value of the xml tag. @Elliot Dierksen Has provided a very good example on how to do this in the CCX editor.
01-29-2022 05:13 AM - edited 01-29-2022 05:15 AM
This document over at DevNet should help you out to get started with this.
01-28-2022 06:10 PM
02-04-2022 08:12 AM
Thank you Elliot. Greatly appreciated.
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