cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3785
Views
5
Helpful
14
Replies

UCCX Script (Set Variable value with a set step)

Adan Zuniga
Level 1
Level 1

All, 

This is probably a silly question, but I am trying to achieve the following. I have a script that has a menu step that is Identical for 2 different Triggers. Depending on the Trigger however, we have different numbers that they do a call redirect to. Each option is for a different campus of our institution. The two campuses are RUMC and ROPH. I have string variables for each menu option 1-9 that are named sMainOptionxROPH and sMainOptionxRUMC. At the beginning of my script I have a Switch with cases for each campus. I have a Switch, because there are more options, but irrelevant for my explanation. On the switch I set the variable sHospCalled to either RUMC or ROPH. In my menu, I need to set the value of the string variable sRedirectNumber to the value of "sMainOption1"+"sHospCalled". The problem is that I need the actual value of the variable for example if sMainOption1ROPH is "65555" I need that value, not the literal string "sMainOption1sHospCalled".Help is greatly appreciated. this goes live tomorrow. 

1 Accepted Solution

Accepted Solutions

Please post your script and specify what the final value of your redirect extension needs to be. I think you are trying to over complicate things here, so these 2 items will clear it up.

View solution in original post

14 Replies 14

Chris Deren
Hall of Fame
Hall of Fame

So, you would have a generic variable call it sRedirectNumber which under each switch option is statically set to a value i.e. "65555" under node1, and "6555X" under node 2. The in the common logic where it's used you simply invoke it. Let's assume that this is an extension you perform redirect to you would have Redirect to string variable sRedirectNumber.

Chris, 

Thank you for your prompt answer. Let me rephrase my question. I want to interpret the values of a string variable as a variable of themselves. for example, I have the following Variables

sHospCalled == "" (Value is dependent of trigger that invokes the script) 

sMainOption1ROPH == "25555"

sMainOption1RUMC == "65555"

I want to dynamically set the value of my sRedirectNumber String Variable. So, I concatinate "sMainOption1"+"sHospCalled". This results in the string of either sMainOption1ROPH or sMainOption1RUMC. As I stated before, that is a variable, but it gets interpreted as the string itself, not the variable value of either "25555" or "65555". To summarize, I would like to interpret the contents of a String variable as a variable and not to the string. 

What is the purpose of concatenating "sMainOption1"+"sHospCalled"?

What should be the outcome of this concatenation? Is it either 25555 or 65555 or something else? Can you post your current script?

Because I want the script to be dynamic an yet minimize my code. So i have sMainOption1-9 and two options for RUMC or ROPH. So I have a total of 18 variables. As a reminder, these are variables for each of my branches of my Menu Step. Each variable contains the string containing the Directory Number that will be used for the call redirect step based on user selection. If a user Calls RUMC, my switch sets the variable sHospCalled to "RUMC" then the goTo sends the call to a menu step. If the user presses 4 then, i set the variable sRedirectNumber to "sMainOption4"+sHospCalled. This results in a string "sMainOption4RUMC". But, remember that I have 18 variables sMainOptionxRUMC(ROPH). Each variable contains a DN. I want that value to be assigned to sRedirectNumber and not the string "sMainOption4RUMC". I tried uploading the script, but file type is not supported. 

Please post your script and specify what the final value of your redirect extension needs to be. I think you are trying to over complicate things here, so these 2 items will clear it up.

Here it is. In the Main Menu, see option 1, that is what I want to do for all of my options, instead of using an IF statement for every option like I currently have. 

The step "set sHospCalled = "ROPH" will set this variable to string ROPH, what is this suppose to be? As I don't think you want to to be this text, yet if you want sHospCalled to be the value of another variable you can use sHospCalled = variableName (without quotes), but I don't see variable ROPH defined.

The I see sRedirectNumber = "sMainOption1"+ sHospCalled, again you are concatenating text (stuff in quotes) with value of a variable which at this time might be ROPH and you end up with "sMainOption1ROPH".

If the goal is to create a value based on 2 inputs, where first is based on the called number and the second is based on caller input during the menu, then do this:

under each switch node set sHospCalled = var1 (use the desired variable name without quotes) 

and next under menu nodes set sRedirectingNumber = var2 + var1 (again no quotes).  

Thank you for your patience and cooperation Chris. 

The step "set sHospCalled = "ROPH" will set this variable to string ROPH, what is this suppose to be? As I don't think you want to to be this text, yet if you want sHospCalled to be the value of another variable you can use sHospCalled = variableName (without quotes), but I don't see variable ROPH defined.

sHospCalled is a variable that identifies which campus was called. BUT The important thing here is that I have string variables for the mainMenu that either end in ROPH or RUMC. 

The I see sRedirectNumber = "sMainOption1"+ sHospCalled, again you are concatenating text (stuff in quotes) with value of a variable which at this time might be ROPH and you end up with "sMainOption1ROPH".

the result of the concatenation of the string "sMainOption1" and the variable sHospCalled should result in something like "sMainOption1ROPH". BUT sMainOption1ROPH is a variable. I want the value of sRedirectNumber to be assigned the value of sMainOption1ROPH. I do not want sRedirectNumber to be assigned the string "sMainOption1ROPH".

If the goal is to create a value based on 2 inputs, where first is based on the called number and the second is based on caller input during the menu, then do this:

under each switch node set sHospCalled = var1 (use the desired variable name without quotes) 

and next under menu nodes set sRedirectingNumber = var2 + var1 (again no quotes).  

kwinstrand
Level 1
Level 1

Adan - Did you ever get this to work?  I've got a very similar issue.  I'm creating a script where callers can select an option and be redirected to a particular cell phone based on their selection.  I'd like to keep all the cell numbers in variables for easy maintenance.

Variables:

cell_userA = 1111

cell_userB = 2222

---

Switch:  

Option 1 - Set usertemp = "userA"

Option 2 - Set usertemp = "userB"

---

Set dialstring = "cell_" + usertemp

---

The desired behavior is that if the caller chooses Option 1, the usertemp variable will be set to "userA" and then the dialstring will be set to "1111".

Unfortunately I did not! I see how in both cases this would be very beneficial. If I find out, I will let you know. As well as if you find a solution, kindly let me know please.

Hello.

I'm looking for same solution. Maybe you found it?

The pitfall here is the use of double quotes around the variable name.

E.g.,

Set prefix = "8"
Set extension1 = "1000"
Set transfer_to = prefix + extension1

That will result in transfer_to being set to 81000

However, contrast that with this:

Set prefix = "8"
Set extension1 = "1000"
Set transfer_to = "prefix" + "extension1"

And you end up with transfer_to being set to prefixextension1. Not what you want.

Andrey Yagunov
Level 1
Level 1

Hi all.

I found a solution for this task. I have 17 triggers attached to one application. I use set step.

Set TriggerIndex = {java.util.HashMap map = new java.util.HashMap(); map.put("Trigger1", Trigger1); map.put("Trigger2", Trigger2); return map.get("Trigger"+x); }

"Trigger1" - set name of variable

Trigger1 - get value of variable 

 

Script attached.

I have a question. Is my script useful or not? If I want to use less system resources, maybe I need to use 17 times "If"?

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: