Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: SDCM-856
Table of Contents
minLevel1
maxLevel7

...

Overview

Virtual Members provide a powerful way to build advanced queries, measures, and KPIs. It allows you to produce dynamic members for a dimension based on a scripting language. It also would allow you to automatically generate matching KPIs for the conditions set for the Virtual Members.

This page aims to provide you with easy-to-follow steps when working with Virtual members based on common use cases outlined in this page. For any other use cases pertinent to Virtual Members, please reach out to the eMite Consulting Team or your eMite account executive for further guidance.

...

Scripting Guidelines

General rules to follow when creating Virtual Members:

...

You may also check out Elastic’s Painless Scripting Guide here.

...

Creating a Virtual Member

  1. Go to KPI Admin screen to access the Virtual Members configuration page. All Virtual Members previously saved will display on the screen.

  2. Click the Add new record button.
    To edit an existing Virtual Member, click on its edit button.

...

The Virtual Member Details will display.

Virtual Members Details Pop-up

The following screenshot is an example of a fully defined Virtual Member.

...

Field Name

Description

Name

What the Virtual Member will be called. Keep this name in mind when linking it with a dimension.

Description

Brief description of the Virtual Member

Connection, Cube, Dimension

Used to select the dimension that you want to link the Virtual Member with

Condition

Contains the logical conditions for each Virtual Member. In the example above, there are 3 conditions defined:

  • Member #1: Will match all rows of the index where the field “TOTAL_TRANSFERS” is less or equal zero.

  • Member #2: Will match all rows where “TOTAL_TRANSFERS” is between 1 and 30.

  • Member #3: Will match all rows where “TOTAL_TRANSFERS” is between 31 and 60. 

Return

Contains the Member Value that will be returned if the condition is met. In the example above, if we were to select all the members of this Virtual member (DimSample3) in a cube report, the result would be:

Info

Note that the members “Option 0”, “Option B”, and “Option C” are wrapped in a tag called “#MemberValue<value>#”. It will only work if you are using this notation and the page will give you an error if you do not do this.

Member Label

Contains the Member Label that will be visible on the eMite dashboards. Note: The Member Label can be different from the Member Value (see Example 1 below).

Info

There are also Edit and Delete buttons next to each Virtual Member condition and buttons to test your Virtual Member conditions depending on the type of aggregation (COUNT, AVG, SUM, MAX, MIN). Please also make sure to click Save to save the Virtual Member.

...

Common Use Cases

Grouping Queues

In this example, we will look at how Virtual Members can be used to group queues based on characters within the queue names.

...

  1. Elasticsearch will store the field as array and sort the array items in alphabetical order.

  2. doc['QueueName'].value will return the first item in the array. 

  3. doc['QueueName'].values will return the whole array.

  4. To do exact match with the array items, use doc['QueueName'].values.contains('searchterm') only when one of the array item equal to searchterm will match it.

  5. To do wildcard match with the array items, first convert the array to string. Use doc['QueueName'].values.toString().contains('searchterm'). All the array items that contain searchterm will match it.

...

Reporting on Null Values

A common requirement is to select the data that is not there. Here is a brief example:

...

Using the logic above, we will be able to filter all rows where the “Organization” field contains a null value:

...

Aliasing DNIS/ANI

In this example, we will look at how Virtual Members can be used to alias DNIS/ANI based on characters within the DNIS/ANI.

Example 1

if(@Dnis != null && doc['Dnis'].value.contains('DNISorANI'))

else if((@Dnis != null && (doc['Dnis'].value.contains('DNISorANI') || doc['Dnis'].value.contains('DNISorANI') || doc['Dnis'].value.contains('DNISorANI') || doc['Dnis'].value.contains('DNISorANI'))))

else if(@Dnis != null && doc['Dnis'].value.contains('DNISorANI'))

...

Example 2

1. Fill out the Name field with what you want the new Virtual Member to be displayed as. 

...

  1. Elasticsearch will store the field as array, and sort the array items in alphabetical order.

  2. doc['QueueName'].value will return the first item in the array. 

  3.  doc['QueueName'].values will return the whole array.

  4. To do exact match with the array items, use doc['QueueName'].values.contains('searchterm') only when one of the array item equal to searchterm will match it.

  5. To do wildcard match with the array items, first convert the array to string. Use doc['QueueName'].values.toString().contains('searchterm'). All the array items that contain searchterm will match it.

...

Testing Virtual Members

When adding a new Virtual Member Definition, there are buttons on the bottom of the Virtual Members Details page.

...

Otherwise, a popup with an error will be displayed.

...

Additional Reference Information

Virtual Members definitions are built on a language called Painless which is a built-in scripting language of Elasticsearch.

...