|
Table Of Contents
How to Use Variables in a Formula
Expanded Call Context (ECC) Variables
Formulas
This chapter discusses formulas in script processing. It includes:
•An introduction to ICM formulas and script processing
•Instructions on how to use the Script Editor's Formula Editor
•A discussion of variables you can use within formulas (Call Control, Expanded Call Context (ECC), and User variables)
•Descriptions and examples for using operators, built-in functions, and custom functions in expressions
Introducing Formulas
A formula consists of one or more expressions that ICM software evaluates to produce a value which it can use for subsequent script processing. You define an expression, which is made up of variables, constants, operators, and functions, to set up custom selection rules or distribution criteria in scripts.
A formula can take many forms, as shown in the examples in Figure 5-1.
Figure 5-1 Sample Formula Formats
In each of the examples in Figure 5-1:
•The Left-value or Right-value is a number, string, variable, function, or other expression.
•The Operator is a symbol that compares the Left-value to the Right-value.
Variables are discussed in detail beginning on page 5-3 of this chapter; operators and functions beginning on 5-12.
Figure 5-2 shows a simple formula that evaluates the value of CallerEnteredDigit variable.
Figure 5-2 Simple Formula
In Figure 5-2, if the CallerEnteredDigit value is equal to 1, the formula returns a value of true; if the CallerEnteredDigit value is not equal to 1, the formula returns a value of false.
The Formula Editor
Many Script Editor node fields require a formula. In some cases, you can simply key the formula into this field. In most cases, however, you will need to click an Edit Formula button to access the Script Editor's Formula Editor, shown in Figure 5-3.
Figure 5-3 Formula Editor
There are two ways to use the Formula Editor to create or modify a formula:
•Enter an expression directly in the Formula field.
•Use the tab lists at the bottom of the Formula Editor dialog box to choose variables and functions and place them in the Formula field.
Introducing Variables
You use variables, which are named objects that can hold a value, in formulas to:
•Determine the best target for each call
•Help in call tracking
This section describes how to use variables in a formula and the different types of variables that are available.
To see all available categories and the specific variables in each category, see the Variables tab in the Formula Editor dialog box.
Note For information on a specific real-time variable, see the description of the appropriate table in the Cisco ICM Software Database Schema Handbook or the online ICM Schema Help.
How to Use Variables in a Formula
The syntax for using a variable in a formula is as follows:
object-type.object-name.variable-name
Where:
•The object-type is an object category, for example, Service.
•The object-name is the name of an object contained in the ICM database, for example, the name of a Service (for example, BosSales).
•The variable-name is a named object that can hold a value, for example, a call control variable (for example, CallerEnteredDigits).
•Each component in the variable is separated by a period (.).
A Single-Target Variable
Figure 5-4 shows an example of a formula that examines the ExpectedDelay variable for a Service, BosSales.
Figure 5-4 A Variable Examining a Single Target
A Multiple-Target Variable
To use a variable to examine multiple targets of a node, use an asterisk (*) as the object-name value. When ICM software executes a variable with an asterisk, it replaces the asterisk by each target in turn.
For example, you could include the formula in Figure 5-5 in a Select node to find the skill group with the maximum value of the variable LongestAvailable.
Figure 5-5 A Variable Examining Multiple Targets
Call Control Variables
The call control variables provide information about the current call request. They include information about where the request came from, call classification data, and information to be passed to the peripheral that receives the call.
You can set the values with some call variables with the Set Variable node. To reference a call control variable in a script, the syntax is Call.variable.
Note For more information on the Set Variable node, see Script Editor Language Reference.
Table 5-1 summarizes the call control variables.
Note For a Post-Routing® request from an Aspect ACD, PeripheralVariable1 through PeripheralVariable5 map to the Aspect variables A through E. The Aspect routing client passes these variables to ICM software as part of the request and ICM software returns them with the response. Other routing clients might use some of these variables for other purposes. The values of these variables are also stored in the Route_Call_Detail table of the ICM database.
Expanded Call Context (ECC) Variables
Expanded Call Context (ECC) variables are variables that you define and enable in the Configuration Manager to store values associated with the call. You can specify the variable name and data type. The name must begin with the string user. These are in addition to the variables the ICM software defines for each call (PeripheralVariable1 through PeripheralVariable10, CallerEnteredDigits, CallingLineID, etc.).
An ECC variable name can be up to 33 bytes long (1-32 usable characters + a null terminator). In addition, it is highly recommended that you use the following naming convention when creating an ECC variable:
user.<CompanyName>.<VariableDescription>
In this syntax:
•<CompanyName> is the name of your company
•<VariableDescription> is a descriptive tag for the variable.
For example, you could use the following name for an ECC variable created for Cisco account numbers:
user.Cisco.AcctNum
Using this naming convention will prevent naming conflicts with any third-party applications that interface with ICM software.
Note If your corporation is large, you may even want to break <VariableDescription> down to include the Business Unit, Division, or other organizational entity that exists in your company.
An ECC variable can be either a scalar variable or an array.
The maximum length of a scalar variable or array element can be 1 to 210 bytes.
The maximum number of elements in an array can be 1 to 255.
The maximum buffer size for each scalar variable = 5 + the maximum length of the variable where the 5 bytes includes 4 bytes to tag the variable and 1 byte for the null terminator.
The maximum buffer size for each array = 5 + (1 + the maximum length of array element) * (the maximum number of elements in the array). There is a null terminator for each element, as well as a null terminator for the array as a whole.
Since the total size of the buffer used to store the variables internally is 2000 bytes, the total sum of all the maximum buffer sizes for each variable and each array must be no greater than 2000.
For example, if you intended to use one scalar ECC variable with a maximum length of 100 bytes, one scalar ECC variable with a maximum length of 80 bytes, and an ECC array with a maximum of 9 elements with each element having a maximum length of 200 bytes, the buffer size would be:
(5+100) + (5+80) + (5 + (1+200)*9) = 2004
This is too large so the length of one of the scalar ECC variables or the length of the array ECC variable needs to be adjusted.
Expanded call variable configuration consists of two steps:
•Setting the Enable Expanded Call Context option in the System Information dialog box
•Defining the variable through the Expanded Call Variable List in the Configuration Manager
How to set the Enable Expanded Call Context option
Step 1 Within the Configuration Manager, select Tools > Miscellaneous Tools > System Information. The System Information window appears.
Step 2 Select Enable Expanded Call Context.
Note For additional information refer to the online Help.
Step 3 Click Save to apply your changes.
How to define an Expanded Call Context (ECC) variable
Step 1 Within the Configuration Manager, select Tools > List Tools > Expanded Call Variable List. The Expanded Call Variable List window appears.
Step 2 In the Expanded Call Variable List window, enable Add by clicking Retrieve.
Step 3 Click Add. The Attributes property tab appears.
Step 4 Complete the Attributes property tab.
Note The Name and Maximum Length fields are required. All other fields are optional. The Name must begin with "user" and cannot exceed 32 characters. The recommended syntax is: user.<CompanyName>.<VariableDescription>.
For additional information refer to the online Help.Step 5 Click Save to apply your changes.
User Variables
You can also create global user variables. For example, you could create a user variable called usertemp to serve as a temporary storage area for a string value used by an If node.
Each user variable must:
•Have a name that begins with user.
•Be associated with an object type, for example, Service. (This enables ICM software to maintain an instance of that variable for each object of that type in the system.)
•Be identified as a persistent (retains value across CallRouter restarts) or non-persistent (does not retain value across CallRouter restarts) variable.
Note A user variable can store a value up to 40 characters long.
After you have defined a variable, you can then use the Script Editor's Formula Editor to access the variable and reference it in expressions, just as you would with a "built-in" variable
Figure 5-6 Formula Editor Dialog Box
How to define a user variable
Step 1 Within the Configuration Manager, select Tools > List Tools > User Variable List. The User Variable List window appears.
Step 2 In the User Variable List window, enable Add by clicking Retrieve.
Step 3 Click Add. The Attributes property tab appears.
Step 4 Complete the Attributes property tab.
Note The Variable name, Object type, and Data type fields are required. All other fields are optional. For additional information refer to the online Help.
Step 5 Click Save to apply your changes.
Operators
ICM software supports a large number of operators. Some operators have one operand; others have more than one. This section contains tables describing the various operators supported by ICM. Most of the table entries include examples.
Prefix Operators
Prefix operators, listed in Table 5-2, take a single operand.
Arithmetic Operators
The arithmetic operators, listed in Table 5-3, take two operands.
Note For further information on the order of evaluation, see the "Operator Precedence" section.
Equality Operators
The equality operators, listed in Table 5-4, take two operands.
Relational Operators
The relational operators, listed in Table 5-5, take two operands.
Logical Operators
Logical operators, listed in Table 5-6, take two operands. Logical operators examine the values of different logical expressions.
Note The equality (==) and relational (<) operators are evaluated before the logical operators (&& and ||). (For more information about the order of evaluation, see the "Operator Precedence" section.)
Bitwise Operators
The bitwise operators, listed in Table 5-7, take two integer operands.
Miscellaneous Operators
The miscellaneous operators, which don't fit in any of the preceding categories, are listed in Table 5-8.
Table 5-8 Miscellaneous Operators
Operator Meaning Comments / Examples?
Conditional
The conditional operator (?) takes three operands. Its syntax is as follows:
condition ? true-result : false-result
ICM software evaluates the expression by first examining the logical expression condition and then doing the following:
•If the result is true, then the overall expression evaluates to the value of the expression true-result.
•If the result is false, then the overall expression evaluates to the expression false-result.
Example: The following expression determines whether the number of agents available for skill group S1 is even or odd:
(SkillGroup.S1.Avail & ~01) ? "even" : "odd"
Note You can achieve the same result by using the If function. See the description of the If function in Table 5-12.
&
Concatenation
The concatenation operator (&) joins two strings end-to-end.
Example: "abc" & "def" returns the value "abcdef".
,
Sequential
The sequential or comma operator (,) takes two operands, each of which is an expression. ICM software evaluates the left expression first and then the right expression. The value of the overall expression is the value of the right expression. The first expression typically affects the valuation of the second.
Call.CallEnteredDigits = 99, Valid(Call.CallerEnteredDigits) ? 1 : 0
<<
Shift left
The shift left (<<) and shift right (>>) operators shift the bits within a value.
The following example shifts the bits in Avail two places to the left. The two rightmost positions are filled with zeroes:
Avail << 2
The following example shifts the bits in Avail two places to the right. In this case, the positions are filled with sign bits (0 if the original value is positive or zero; 1 if the original value is negative).
Avail >> 2
>>
Shift right
Operator Precedence
To write expressions correctly, you must understand the order in which ICM software evaluates each operator. Table 5-9 lists the levels of operator priority.
Note The operators with priority 1 are evaluated first, then those with priority 2, and so on. The order of evaluation within each priority level can also be important. Prefix operators are evaluated from right-to-left in an expression. Assignment operators are also evaluated from right-to-left. In all other cases where operators have equal priority, they are evaluated left-to-right.
Built-in Functions
ICM software provides a number of built-in functions that you can use in formulas. These functions allow you to manipulate dates and times, perform several standard mathematical operations, and so forth.
The tables in this section summarize the functions according to category.
Table 5-10 lists the functions that manipulate dates and times.
Table 5-11 lists the mathematical functions.
Table 5-12 lists the other built-in functions that are available.
Custom Functions
You can create custom functions for use within scripts. A custom function represents an expression. Optionally, the expression can contain parameters that receive values when the function is called.
You can also import or export a custom function from one system to another.
How to add a custom function
Step 1 Within Script Editor, select Script > Custom Functions. The Custom Functions dialog box appears, listing all the custom functions currently defined.
Step 2 Click the Add button to open the Add Custom Function dialog box.
Step 3 Specify the following:
•Function name. All custom function names must begin with user.
•Number of Parameters. The number of parameters to be passed to the function. A function may take 0, 1, or more parameters.
•Function definition. The expression to be evaluated when the function is called. When entering the function definition, keep the following in mind:
–The parameters to a function are numbered beginning with 1. To reference a parameter within the expression, surround it with percent signs (%). For example, %3% is a reference to the third parameter.
–The lower portion of the dialog box is just like the Formula Editor. You can use it to help build the expression.
Step 4 When done, click the Test button. The Test Function dialog box appears.
Step 5 Test the function by entering an example of how you might reference the function. Include a specific value for each parameter.
Step 6 Click the Evaluate button to see how the Script Editor interprets the function call and click Close to return to the Add Custom Function dialog box.
Step 7 Use one of the Validate buttons to validate the scripts that reference a selection function. (The Validate All button lets you validate all the scripts that reference any custom function.)
Step 8 When finished, click OK to apply changes and to close the dialog box.
How to import a custom function
Step 1 Within Script Editor, select Script > Custom Functions to open the Custom Functions dialog box.
Step 2 Click Import. The Import Custom Function dialog box appears.
Step 3 Choose a file name with an ICMF extension (.ICMF) and click Open. The Script Editor examines the file for naming conflicts. If a conflict is found, a dialog box appears listing options for resolving the conflict.
Step 4 Choose one of the options and click OK.
Note If you choose to rename the function, the new name must begin with user.
Step 5 The Script Editor performs automapping and the following happens:
•If all imported objects were successfully auto-mapped, a message window appears prompting you to review the mappings. Click OK to access the Object Mapping dialog box.
•If some imported objects were not successfully auto-mapped, the Object Mapping dialog box appears, with all unmapped objects labeled "Unmapped."
The Object Mapping dialog box contains three columns:
•Object Types. The type of imported objects.
•Imported Object. Name of imported object.
•Mapped To. What this imported object will be mapped to.
Step 6 (Optional.) Click an Imported Object value. The Mapped To column displays all the valid objects on the target system.
Step 7 (Optional.) Select an object from the Mapped To column's drop-down list on the target system that you want to map the imported object to.
Note Multiple objects may be mapped to the same target. Objects may be left unmapped; however, the resulting custom function will not be valid until all objects are mapped.
Step 8 When the mapping is complete, click Apply and Finish.
How to export a custom function
Step 1 Within Script Editor, select Script > Custom Functions to open the Custom Functions dialog box.
Step 2 Select the custom function(s) from the list and click Export. The Export Custom Function dialog box appears.
Note If you selected a single function, that function's name appears in the File Name field. If you selected more than one function, the File Name field is blank.
Step 3 (Optional.) Change the File Name.
Note You cannot change the file type; the script can only be saved in .ICMF format.
Step 4 Click Save. If the file name already exists, the system prompts you to confirm the save.
Step 5 If prompted, click OK. The custom function(s) are saved to the specified file in text format.
Posted: Fri Nov 18 07:27:27 PST 2005
All contents are Copyright © 1992--2005 Cisco Systems, Inc. All rights reserved.
Important Notices and Privacy Statement.