Professional Documents
Culture Documents
Formula PDF
Formula PDF
Formulas
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.
Example 1: Right-value
36979
Example 3: Left-value Operator Right-value
CallerEnteredDigits == 1
36999
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.
A Single-Target Variable
Figure 5-4 shows an example of a formula that examines the ExpectedDelay
variable for a Service, BosSales.
Service.BosSales.ExpectedDelay
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.
Object-name
Object-type Variable
(asterisk)
Max(SkillGroup.*.LongestAvailable)
Note For more information on the Set Variable node, see Script Editor Language
Reference.
Using this naming convention will prevent naming conflicts with any third-party
applications that interface with ICM software.
Step 1 Within the Configuration Manager, select Tools > Miscellaneous Tools > System
Information. The System Information window appears.
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.
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.
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.
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
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.
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.
Example:
• Service.Order.AgentsLoggedOn -
Service.Order.AgentsAvailable returns the number of agents who
are logged on to the service but not currently available.
• 2 + 3 * 4 evaluates to 14 because the multiplication is performed
first.
Note For further information on the order of evaluation, see the “Operator
Precedence” section on page 5-18.
Equality Operators
The equality operators, listed in Table 5-4, take two operands.
Example:
• Service.Sales.CallsQNow != 0 is true if any calls are currently
queued for the service.
• Service.Sales.AgentsLoggedOn == Service.Sales is true if all
agents logged on to the service are currently available.
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 on page 5-18.)
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.
Note You can achieve the same result by using the If function. See
the description of the If function in Table 5-12 on page 5-23.
& 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
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.
This function is useful for comparing the current date and time to
a specific point in time. Example: to test whether the current date
and time is later than 10 p.m., December 24, 2001, use the
expression now() > date(2001,12,24) + time(22,0).
second [ ( time ) ] Integer Returns the seconds (0-59) of the current time or a given time.
The given time must be a floating-point value, as returned by the
time function.
Example: second() >= 50 tests whether the current time is within
the last ten seconds of a minute.
time [ ( time ) ] Float Returns the current system time or the time portion of a date-time
value. The given time can be a floating point value, a string of the
form “hh:mm:ss”, or two or three numeric values: hh, mm [, ss ].
Example:
• time (with no arguments) returns the current time.
• time() > time(“14:00:00”) tests whether the current time is
after 2:00 PM.
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.
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.
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 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.
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.