System and Script Variables
Variables are used for storing temporary script run specific values in a script. Typically used for displaying calculated values to agents or accessing system values. Variables are a means of storing a real time calculated value that will change on each agent action within eac script run and is not needed after the script run. When we create a variable, we are essentially creating a storage place, into which we can put any value for use elsewhere in the script.
CallScripter has a wide range of built-in system variables which produce access to system information. You can also create your own Script Variable.
System Variables
CallScripter's built in variables provide access to a wide range of system information that you may wish to use in your script or subsequent reports. Probably the most commonly used example of a system variable is var_csAgentName, which is often used in labels on the opening page of a script, e.g.,
"Welcome to CompanyCo, my name is [var_csAgentName]…"
Creating and using Script Variables
Variables can be created within a script. They are only available within that script. Creating variables is simple. Go to Tools Script Variables, and click on Add. Adding a description for your variable is a good idea; not only will it help you remember what it was created for, but it is also shown when using variables in calculations.
Before creating a new script variable, you should check that it doesn't already exist.
Using Script Variables
When using Script Variables it is important to remember that all Script Variables that have values set by Calculate Fields are recalculated on each mouse click after being wiped/blanked. This means that if a calculate field sets a Script Variable's value if only certain conditions are met, then other cases will cause the Script Variable's value to be blanked (set to "").
System Variables are not affected by the recalculations as their values will be set back to the same value by the System.
Script Variables are designed for using to display information within the Script to an agent, as shown by the example below.
Script Variables values should not be used in database queries and calls to externals systems as they may recalculate their value mid query. Instead use Hidden Fields as they will hold their value continuously.
Using a Variable to populate a Text Label
You cannot add a field directly to a text label, but you can put the content of the field into a variable, and then display the variable content in the text label, which gives the same result.
· Add a text box to the page. Name it [my_text]
· Create a script variable to hold whatever is typed into the text box. name it var_my_text.
· Add a calculate field that puts the content of the text box in the variable: [var_my_text] = [my_text]
· Add the variable to a label in order to display it.
Monitoring Script Variable Values
System and Script Variables can be monitored when test running a script. Versions prior to release 26 will always display 3 columns, users of version 26+ can set the number of variable columns they wish to view. This is useful is the variable field contains a long string of data.