06-21-2010 09:23 AM - edited 03-15-2019 11:20 PM
Hello !
Using UCCX 7.0 script editor how i can use ten or more posibles values in string variables?, for example
i´m try to do this:
If caller id is: 6767 compare with variable "number"
i want to variable number = 8900 or 6767or 8742 or 8812
variable number is string.
What can i do?
BR
06-21-2010 11:04 AM
Well there's a few ways of going about this. This is more of a Java programing question than a CCX question though.
One of the easier ways would be to just create a String-type variable with a comma separated list of values you want (e.g. myString = "8900,6767,8742,8812"). From that you can use the Java .indexOf(String str) method to find the pattern you want within the variable.
Example:
Set myString = "8900,6767,8742,8812"
Set callingNumber = "6767"
If (myString.indexOf(callingNumber) >= 0)
True
Your logic here.
False
Your logic here.
Essentially, the indexOf method will return an integer value of the first occurrence within the String variable of the given pattern. In this case you don't care about this, what you care about is what happens if it doesn't find that pattern. In that case it returns a -1 value.
Most people use a Switch (Match Case) statement here and just list out the individual matching conditions they want. Without knowing the use case it's hard to tell you what the best way forward is.
06-21-2010 12:08 PM
Hi, Jonathan
Thank you, but can you be more explicit with the procedure?
When i could be do this steps inside script editor?
06-21-2010 12:09 PM
I don't understand what you are asking. I gave you exact steps and expression logic to use.
06-21-2010 12:43 PM
I know now, im a little confused when you talk me about java.
But now it´s working. Thank you very much !!!!!
06-21-2010 12:46 PM
Ah ok. The CCX script is actually Java with a pretty UI slapped on top of it to make it easier for folks. The expression logic and anything fancy is where you need to break out "real" Java code is all.
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