< User:Olena‎ | SS
Jump to: navigation, search

Olena/SS/Formula

FORMULA

Aggregates
Aggregator Parameters Description Example
@COUNT action_types_list Mandatory. Comma separated list of Stat Server actions or statuses
condition Optional. Boolean expression, depending on action/status attributes, interval attributes and system variables
Current aggregator that returns current number of actions or statuses listed in action_types_list that matches the condition if provided. @COUNT(CallInternal, CallInbound, CallConsult; kvexists(udata, "Language", "English")) – returns current number of actions/statuses listed, that have "Language", "English" key-value pair in attached UserData.
@SUM action_types_list Mandatory. Comma separated list of Stat Server actions or statuses
expression Mandatory. Numeric expression, depending on action/status attributes, interval attributes and system variables
condition Optional. Boolean expression, depending on action/status/st attributes, interval attributes and system variables
Current aggregator that returns current sum of numeric expressions, computed for each action or status, satisfying the condition. @SUM(CallWait; kvnum(global_udata, "amount", -1)) – returns current sum of the last value in each CallWait action of "amount" key in attached UserData.
@AVG action_types_list Mandatory. Comma separated list of Stat Server actions or statuses
expression Mandatory. Numeric expression, depending on action/status attributes, interval attributes and system variables
condition Optional. Boolean expression, depending on action/status attributes, interval attributes and system variables
Current aggregator that returns current average of numeric expressions, computed for each action or status, satisfying the condition. @AVG(CallOutbound; duration; duration > 0 & duration < 5) – returns current average duration of CallOutbound actions/statuses with duration less than 5 seconds.
@MIN action_types_list Mandatory. Comma separated list of Stat Server actions or statuses
expression Mandatory. Numeric expression, depending on action/status attributes, interval attributes and system variables
condition Optional. Boolean expression, depending on action/status attributes, interval attributes and system variables
Current aggregator that returns current minimum of numeric expressions, computed for each action or status, satisfying the condition. @MIN(WaitForNextCall; duration) – returns current minimum duration of WaitForNextCall action/status
@MAX action_types_list Mandatory. Comma separated list of Stat Server actions or statuses
expression Mandatory. Numeric expression, depending on action/status attributes, interval attributes and system variables
condition Optional. Boolean expression, depending on action/status attributes, interval attributes and system variables
Current aggregator that returns current maximum of numeric expressions, computed for each action or status, satisfying the condition. @MAX(NotReadyForNextCall; duration; kvexists(reasons, "ReasonCode", "Break")) – returns current maximum duration of NotReadyForNextCall action/status with "ReasonCode" = "Break"
COUNT action_types_list Mandatory. Comma separated list of Stat Server actions or statuses
condition Optional. Boolean expression, depending on action/status attributes, interval attributes and system variables
Historical aggregator that returns total number of actions or statuses listed in action_types_list that matches the condition if provided. COUNT(CallInternal, CallInbound, CallConsult; kvexists(udata, "Language", "English")) – returns total number of actions/statuses listed, that have "Language" = "English" key-value pair in attached UserData.
SUM action_types_list Mandatory. Comma separated list of Stat Server actions or statuses
expression Mandatory. Numeric expression, depending on action/status attributes, interval attributes and system variables
condition Optional. Boolean expression, depending on action/status attributes, interval attributes and system variables
Historical aggregator that returns sum of numeric expressions, computed for each action or status, satisfying the condition. SUM (CallInternal, CallInbound, CallConsult; duration; kvnum(udata, "amount", -1) < 100) – returns sum of actions/statuses duration if this action/status has last value of "amount" key in attached UserData less than 100.
AVG action_types_list Mandatory. Comma separated list of Stat Server actions or statuses
expression Mandatory. Numeric expression, depending on action/status attributes, interval attributes and system variables
condition Optional. Boolean expression, depending on action/status attributes, interval attributes and system variables
Historical aggregator that returns average of numeric expressions, computed for each action or status, satisfying the condition. AVG(CallWait; duration; duration >= 10) – returns average duration of CallWait action if action duration was more than or equal to 10 seconds.
MIN action_types_list Mandatory. Comma separated list of Stat Server actions or statuses
expression Mandatory. Numeric expression, depending on action/status attributes, interval attributes and system variables
condition Optional. Boolean expression, depending on action/status attributes, interval attributes and system variables
Historical aggregator that returns minimum of numeric expressions, computed for each action or status, satisfying the condition. MIN(AgentActive; duration) – returns minimum duration of AgentActive action.
MAX action_types_list Mandatory. Comma separated list of Stat Server actions or statuses
expression Mandatory. Numeric expression, depending on action/status attributes, interval attributes and system variables
condition Optional. Boolean expression, depending on action/status attributes, interval attributes and system variables
Historical aggregator that returns maximum of numeric expressions, computed for each action or status, satisfying the condition. MAX(CallInbound; kvmax(udata, "amount"); kvexists(udata, "Language", "English")) – returns maximum value of "amount" key in UserData of CallInbound actions/statuses for which key-value pair "Language" = "English" also be presented in UserData.

The following attributes are used in expression and condition parameters of aggregators:

Attribute Description
duration A duration of Stat Server action/status.
start A timestamp of the start time of Stat Server action/status.
end A timestamp of the end time of Stat Server action/status.
udata UserData key-value list. List of data that is used in key-value pair functions as the first argument.
global_udata Global UserData key-value list. List of data that is used in key-value pair functions as the first argument.
reasons Reasons key-value list. List of data that is used in key-value pair functions as the first argument.
extensions Extensions key-value list. List of data that is used in key-value pair functions as the first argument.
system System key-value list. List of data that is used in key-value pair functions as the first argument.

The table below lists mathematical functions that are used in the expression and condition parameters of aggregators as well as in independent clauses:

Function Description
abs Absolute value
ceil Ceiling of the value
floor Floor of the value
log Logarithm of the value
exp Exponent of the value
sqrt Square root of the value
sin Sinus of the value
cos Cosinus of the value
pow Power of the value
% Module (for example, 5%2=1, and 64%4=0)

String functions are applicable to set parameters, for example Language, and values returned by the kvstr function, for example kvstr(udata, "Language"). The table below lists applicable string functions:

Function Description
kvstr A string extraction from the key-value list.
kvlist An embedded key-value list extraction from the key-value list.
kvnum A number extraction from the key-value list.
kvsum A Sum of numbers in the key-value list.
kvmin A minimum value for a given key in the key-value list.
kvmax A maximum value for a given key in the key-value list
kvavg An average value for a given key in the key-value list.
kvexists True if a given key or pair <key,value> exists in the key-value list. False otherwise.
convert String conversion to a numeric value. For example, convert("32.58") returns the 32.58 numeric value.

The key-value list functions are similar to those presented in the UserData Properties. The following collections are taken as the first parameter:

  • udata
  • global_udata
  • reasons
  • extensions
  • system

Ranking functions (see table below) are used in conditions of aggregators to rank Stat Server actions by some parameters.

Function Description
rank_lt True, if the rank of an action, according to a condition, is less than the predefined number.
rank_gt True, if the rank of an action, according to a condition, is greater than the predefined number.

Sorting functions (greatest, least) can take any numeric values (including aggregators) as arguments. Please refer to art-l document for the description and example.

Branching construction (<conditions> ? <expression if condition is true> : <expression if condition is false>) can be used in any part of formula and similar to inline if described in Filter Expression Evaluations section on Filter page of UG.

Operators and their priority (^, -, +, etc.) can be used in any part of the formula expression. Please refer to art-l document for the full list of them.

This page was last edited on August 29, 2017, at 20:56.
Comments or questions about this documentation? Contact us for support!