Using variables to compare

Answered Question
Jun 19th, 2010
User Badges:

Hi all,


In need compare called number with a variable. For example, variable is: "extension". If "extension" is "3234" go to label "numbers begin with 32", but if "extension" is "3520" go to label "numbers begin with 35". I know what can i do to identiefied called number and make go to.


I need to know how compare the called number with a range extension.


What can i do?

Correct Answer by William Bell about 7 years 1 month ago

Yes, you will need both the myextension and myrange variables declared as type String.  I also double checked the syntax on my CRS editor.  Looks like the expression builder is looking for .substring as the method as opposed to .substr.  My apologies for the confusion.  Also, the curly braces aren't necessary.  I was trying to show that you would use the expression builder.


Anyway, take a look at this screen shot:


This can be applied without catching a syntax error and should work for you.  Try it out and let us know.


HTH.


Regards,
Bill

Correct Answer by William Bell about 7 years 1 month ago

Could you please identify the product and version that you are trying to use to accomplish this task?


IF UCCX, then you could use the expression builder and something like this:


Set myextension="32567"  /*insert and use your existing process to collect these digits

Set myrange = {myextension.substr(0,2)}



Switch (Str myrange)

...etc...



Check this link for more info on the string functions available to you via the expression builder:


http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html


And here for syntax requirements of the .substr() method:


http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html#substring%28int,%20int%29



HTH.


Regards,
Bill

Please remember to rate helpful posts.

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 4.6 (8 ratings)
Loading.
htluo Sat, 06/19/2010 - 17:23
User Badges:
  • Red, 2250 points or more

It sounds like you're asking for a programming technique.  It depends on what programming language you're using.


For example, in Visual Basic, you may use Left(strVar, 2) or strVar.Substring(0, 2) to extract the first two digits.


Michael

http://htluo.blogspot.com

Correct Answer
William Bell Sat, 06/19/2010 - 17:43
User Badges:
  • Purple, 4500 points or more

Could you please identify the product and version that you are trying to use to accomplish this task?


IF UCCX, then you could use the expression builder and something like this:


Set myextension="32567"  /*insert and use your existing process to collect these digits

Set myrange = {myextension.substr(0,2)}



Switch (Str myrange)

...etc...



Check this link for more info on the string functions available to you via the expression builder:


http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html


And here for syntax requirements of the .substr() method:


http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html#substring%28int,%20int%29



HTH.


Regards,
Bill

Please remember to rate helpful posts.

diegorgarces Mon, 06/21/2010 - 05:59
User Badges:

Hi all.

I´m working with Uccx 7.0

I try to identified around 400 extensions. Let me try with William´s recomendation.


William: it´s posible follow your recomendation using editor script to uccx 7?

William Bell Mon, 06/21/2010 - 06:56
User Badges:
  • Purple, 4500 points or more

When you use the "set" step for variable myrange you can use the expression builder to add the string manipulation.


Regards,

Bill

diegorgarces Tue, 06/22/2010 - 07:04
User Badges:

In expression builder i´m using

Set myrange = {myextension.substr(0,2)}, but i have an error.


Unable to parse expression; undefinied method: substr for class:java.lang.String (line:1, col:2)


myrange variable could be type: String?

Correct Answer
William Bell Tue, 06/22/2010 - 08:26
User Badges:
  • Purple, 4500 points or more

Yes, you will need both the myextension and myrange variables declared as type String.  I also double checked the syntax on my CRS editor.  Looks like the expression builder is looking for .substring as the method as opposed to .substr.  My apologies for the confusion.  Also, the curly braces aren't necessary.  I was trying to show that you would use the expression builder.


Anyway, take a look at this screen shot:


This can be applied without catching a syntax error and should work for you.  Try it out and let us know.


HTH.


Regards,
Bill

Actions

This Discussion