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

Olena/SS/GroupBy

GroupBy Feature as of Mar 30, 2016

Starting with release 8.5.103, Stat Server in regular mode supports the GroupBy stat type specifier. GroupBy defines the mapping of an action to a group. Each action belongs to only one group at any moment of time.

GroupBy statement is the expression list of the following format: expression | expression ',' expression_list. An expression can be of types: bool, float, int, and string.

The result (an array and/or the overall value) is defined by Category and is calculated for each individual group.

There are three optional specifiers that can be used with GroupBy in stat types:

  • OrderBy
    OrderBy has the following syntax:
    OrderBy = <list_of_tokens>
    list_of_tokens := token | token , list_of_tokens
    token := sign | integer
    sign := <empty> | + (default) | -

    integer in the token definition specifies the index of element in GroupBy expression.
  • RowCount
    RowCount stat type specifier allows to limit the number of the returned groups. It has the following syntax: RowCount = integer
    If RowCount is not specified, the internal default INT_MAX (2147483647) is used. The valid value range for the RowCount is from 0 (zero) to INT_MAX.
  • GroupByColumns
    Optional GroupByColumns specifies column names, corresponding to GroupBy.
    The value of this option is sent to a client in the response for SGetProfile(SPFStatTypes) in the GroupByColumns key in the embedded key-value list, associated with GroupBy StatType. The parsing/validation of the value is done on the client side. In addition, SGetProfile(SPFStatTypes) contains the OriginalGroupByColumns pair and a value of type=KVList in the embedded key-value list, also associated with the GroupBy StatType, in order to provide parsed GroupBy expression operands in a normalized form.
Tip
Indexes start with 1.
If OrderBy is not provided, the groups come unordered.
Use the minus (-) sign to sort in descending order.

Only Subject=DNAction is allowed for GroupBy.

GroupBy is not compatible with Formula=DistByConnID.

Important
  • Legacy clients, such as CCPulse+, do not support GroupBy.
  • Filters can be used in combination with GroupBy.
  • GroupBy stat types are serialized into/from backup file, as well as other statistics.
  • GroupBy is supported with old (dynamic) API as well.

The following categories cannot be used with GroupBy:

CurrentState CurrentStateReasons
CurrentTargetState JavaCategory
ServiceFactor1 LoadBalance1
TotalNumberErrors EstimWaitingTime
LoadBalance EstimTimeToComplete
Formula ExpectedWaitTime2
CurrentDistinctNumber TotalDistinctTime

GroupBy cannot be used with the following statistics:

  • CurrentNumber/Queue/DNAction/CallWait without filter (and distinguish)
  • CurrentNumber/RoutePoint/DNAction/CallWait without filter (and distinguish)
  • CurrentNumber/GroupQueues/DNAction/CallWait without filter (and distinguish)
  • CurrentNumber/Queue/DNAction/AgentLogin
  • CurrentNumber/RoutePoint/DNAction/AgentLogin
  • CurrentNumber/GroupQueues/DNAction/AgentLogin
  • CurrentNumber/Queue/DNAction/AgentActive
  • CurrentNumber/RoutePoint/DNAction/AgentActive
  • CurrentNumber/GroupQueues/DNAction/AgentActive
  • CurrentNumber/Queue/DNAction/AgentReady
  • CurrentNumber/RoutePoint/DNAction/AgentReady
  • CurrentNumber/GroupQueues/DNAction/AgentReady
  • CurrentNumber/Queue/DNAction/DNLogin
  • CurrentNumber/RoutePoint/DNAction/DNLogin
  • CurrentNumber/GroupQueues/DNAction/DNLogin
  • CurrentNumber/Queue/DNAction/DNActive
  • CurrentNumber/RoutePoint/DNAction/DNActive
  • CurrentNumber/GroupQueues/DNAction/DNActive
  • CurrentNumber/Queue/DNAction/DNReady
  • CurrentNumber/RoutePoint/DNAction/DNReady
  • CurrentNumber/GroupQueues/DNAction/DNReady
  • CurrentRelativeNumberPercentage/Queue/DNAction
  • CurrentRelativeNumberPercentage/RoutePoint/DNAction
  • CurrentRelativeNumberPercentage/GroupQueues/DNAction

If the queue-use-pseudo-actions configuration option is set to true, GroupBy cannot be used with the following statistics:

  • CurrentNumber/Campaign/CampaignAction/SCMPARecordsNotProcessed
  • CurrentNumber/CallingList/CampaignAction/SCMPARecordsNotProcessed
  • CurrentNumber/Campaign/CampaignAction/SCMPARecordsScheduled
  • CurrentNumber/CallingList/CampaignAction/SCMPARecordsScheduled


Example 1.

The result of applying
GroupBy=GetString(System',"key"), PairExists(UserData, "key2","*")
to
Action(type=CallInternal, System=[{"key","value"}], UserData=[])
is
{ "value", false }.


Example 2.

The following actions are generated on an agent:

Action( type= CallInbound, UserData =[{"key","a"}] ),
Action( type= CallInbound, UserData =[{"key","a"}] ),
Action( type= CallInbound, UserData =[{"key","b"}] ),
Action( type= CallInbound, UserData =[{"key2","c"}] )

After applying the following statistic:

Category=TotalNumber
Objects=Agent, GroupAgents
MainMask=CallInbound
Subject=DNAction
GroupBy=GetString( UserData, "key" )

We get the following array:

Group Value
"a" 2
"b" 1
null 1

where null is a special token, which indicates the absence of a key.


Example 3.

GroupBy= GetString( System, "ObjectID" ), GetString( System, "InteractionType" ), PairExists( UserData, "key", "*" )
OrderBy=+1,-3
RowCount=100

GroupBy Feature as of Feb 25, 2016

Starting with release 8.5.103, Stat Server in regular mode supports GroupBy stat type specifier with the following syntax:

GroupBy = <group_by_statement>
group_by_statement := expression_list
expression_list := expression | expression ',' expression_list
expression := <bool expr> | <float expr> | <int expr> | <string expr>

GroupBy defines the mapping of an action to a group (each action instance at any moment of the time belongs to one and only one group).

Example 1.

If GroupBy=GetString(System',"key"), PairExists(UserData, "key2","*") is applied to Action( type=CallInternal, System=[{"key","value"}], UserData=[] ), the resultant group will be { "value", false }.

The aggregation (as prescribed by Category) is performed for each individual group.

The resultant value is an array:

Group Value
Group1 Value1
Group2 Value2
... ...
GroupN ValueN

The overall value is provided as well, along with the array.

Example 2.

Category=TotalNumber
Objects=Agent, GroupAgents
MainMask=CallInbound
Subject=DNAction
GroupBy=GetString( UserData, "key" )

If the following actions are generated on an agent:

Action( type= CallInbound, UserData =[{"key","a"}] ),
Action( type= CallInbound, UserData =[{"key","a"}] ),
Action( type= CallInbound, UserData =[{"key","b"}] ),
Action( type= CallInbound, UserData =[{"key2","c"}] )

the resultant array will be:

Group Value
"a" 2
"b" 1
null 1

where null is a special token, indicating the absence of a key.

There are three optional specifiers that can be used with GroupBy in stat types:

  • OrderBy
  • RowCount
  • GroupByColumns

OrderBy has the following syntax:

OrderBy = <list_of_tokens>
list_of_tokens := token | token , list_of_tokens
token := sign | integer
sign := <empty> | + (default) | -

integer in the token definition specifies the index of element in GroupBy expression.

Tip
Indexes start with 1.
If OrderBy is not provided, the groups come unordered.
Use the minus (-) sign to sort in descending order.

RowCount stat type specifier allows to limit the number of the returned groups. It has the following syntax: RowCount = integer

If RowCount is not specified, the internal default INT_MAX (2147483647) is used. The valid value range for the RowCount is from 0 (zero) to INT_MAX.

Example 3.

GroupBy= GetString( System, "ObjectID" ), GetString( System, "InteractionType" ), PairExists( UserData, "key", "*" )
OrderBy=+1,-3
RowCount=100

Optional GroupByColumns specifies column names, corresponding to GroupBy. The value of this option is passed through to a client in the response for SGetProfile(SPFStatTypes) in the GroupByColumns key in the embedded key-value list, associated with GroupBy StatType. The parsing/validation of the value is done on the client side. In addition, SGetProfile(SPFStatTypes) contains the OriginalGroupByColumns pair and a value of type=KVList in the embedded key-value list, also associated with the GroupBy StatType, in order to provide parsed GroupBy expression operands in a normalized form.

The following categories cannot be used with GroupBy:

  • CurrentState
  • CurrentStateReasons
  • CurrentTargetState
  • JavaCategory
  • ServiceFactor1
  • LoadBalance1
  • TotalNumberErrors
  • EstimWaitingTime
  • LoadBalance
  • EstimTimeToComplete
  • Formula
  • ExpectedWaitTime2
  • CurrentDistinctNumber
  • TotalDistinctTime

Only Subject=DNAction is allowed for GroupBy.

GroupBy is not compatible with Formula=DistByConnID.

GroupBy cannot be used with the following statistics:

CurrentNumber/Campaign/CampaignAction/SCMPARecordsNotProcessed CurrentNumber/CallingList/CampaignAction/SCMPARecordsNotProcessed CurrentNumber/Campaign/CampaignAction/SCMPARecordsScheduled CurrentNumber/CallingList/CampaignAction/SCMPARecordsScheduled

and, if the queue-use-pseudo-actions configuration option is set to true, with the following statistics:

CurrentNumber/Queue/DNAction/CallWait without filter (and distinguish) CurrentNumber/RoutePoint/DNAction/CallWait without filter (and distinguish) CurrentNumber/GroupQueues/DNAction/CallWait without filter (and distinguish) CurrentNumber/Queue/DNAction/AgentLogin CurrentNumber/RoutePoint/DNAction/AgentLogin CurrentNumber/GroupQueues/DNAction/AgentLogin CurrentNumber/Queue/DNAction/AgentActive CurrentNumber/RoutePoint/DNAction/AgentActive CurrentNumber/GroupQueues/DNAction/AgentActive CurrentNumber/Queue/DNAction/AgentReady CurrentNumber/RoutePoint/DNAction/AgentReady CurrentNumber/GroupQueues/DNAction/AgentReady CurrentNumber/Queue/DNAction/DNLogin CurrentNumber/RoutePoint/DNAction/DNLogin CurrentNumber/GroupQueues/DNAction/DNLogin CurrentNumber/Queue/DNAction/DNActive CurrentNumber/RoutePoint/DNAction/DNActive CurrentNumber/GroupQueues/DNAction/DNActive CurrentNumber/Queue/DNAction/DNReady CurrentNumber/RoutePoint/DNAction/DNReady CurrentNumber/GroupQueues/DNAction/DNReady CurrentRelativeNumberPercentage/Queue/DNAction CurrentRelativeNumberPercentage/RoutePoint/DNAction CurrentRelativeNumberPercentage/GroupQueues/DNAction

MainMask: CallWait
AgentLogin
AgentActive
AgentReady
DNLogin
DNActive
DNReady
RelMask: CallWait
AgentLogin
AgentActive
AgentReady
Important
  • Legacy clients, such as CCPulse+, do not support GroupBy.
  • Filters can be used in combination with GroupBy.
  • GroupBy stat types are serialized into/from backup file, as well as other statistics.
  • GroupBy is supported with old (dynamic) API as well.
This page was last edited on March 31, 2016, at 14:03.
Comments or questions about this documentation? Contact us for support!