* Case

Overview

The Case object represents a standard CASE or SWITCH CASE construct as in any standard programming or scripting language. It is typically used within the dialog to fork the flow into multiple branches depending on certain business rules, e.g. to switch between different dialog flows depending on the caller’s status.

The Object Definition below covers the configuration of the Case object with VoiceObjects Desktop. For information on how to define this object type using VoiceObjectsXML, refer to the VoiceObjectsXML Definition paragraph.

The Case object belongs to the object category Logic.

Dialog Flow Scenario

The following dialog flow example shows the use of a Case object in a credit card service portal. It branches the dialog into different subdialogs depending on the status of a caller.


Object – Caller

Dialog Flow

Retrieve the caller status from the back-end. Can be one of green_card, gold_card, or platinum_card.

*

Branch into first dialog flow for status green_card.

Branch into second dialog flow for status gold_card.

Branch into third dialog flow for status platinum_card.

Object Definition

The Definition of the Case object provides the following sections:

·         Case Indicator
To link a Variable, Expression, Script, or Layer object to compare values to.

·         WHEN
To define the various branching conditions and to link an object to be processed if a condition is true.

·         ELSE
To define an object to be processed in case none of the WHEN items evaluated to true.


 

For further details regarding additional object configuration refer to Pre-/Postprocessing and Properties in this Object Reference.

i8    Note: The Case object can be defined in two different modes:

·          Provide an object as a case indicator and define the WHEN items by comparing the content of this object to some values (static or dynamic).
Use this mode if the WHEN items all depend on the values of one specific object of your project, typically a Variable or Expression object.

·          Specify the WHEN items by explicit condition declarations. In this case, you must not define a case indicator.
Use this mode if the WHEN items are rather unrelated to each other, and they all depend on distinct conditions.

Case Indicator

The Case Indicator section defines a reference to a Variable, Expression, Script, or Layer object. The content of this object is compared to the values defined in the various WHEN items within the WHEN section at call time. Defining the case indicator is only necessary when using the first of the two possible definition modes of the Case object (i.e. comparing a value against a set of values).


WHEN

The WHEN section defines a list of WHEN-THEN items that correspond either to certain values of the case indicator (if one is defined), or to a certain Boolean condition, depending on the mode used for the Case object.


 

Each WHEN-THEN item provides the following fields:


Property

Description

Label

Optional parameter to identify the WHEN-THEN item in a list. The label is also displayed in the Dialog Designer.

Value/Condition

The definition of this field depends on the mode used for the Case object. If a case indicator is defined in the Case Indicator section, specify a single value or a comma-separated list of values that are compared at call time to the current value of the object specified as case indicator. You can also link a Variable, Expression, Script, Collection, or Layer object in this field to dynamically determine the comparison values.
If no case indicator is defined, link a Variable, Expression, Script, Collection, or Layer object, the evaluation of which will determine if the WHEN-THEN item is processed or not. If the given object evaluates to true at call time, the item is processed; if it evaluates to false, the item is not processed.

Object

Specifies the object that is to be processed if
either the value specified in the Value/Condition field equals the value defined in the CASE section (if one is defined),
or the condition defined for this WHEN-THEN item evaluates to true.

i8  Note: The WHEN-THEN items are evaluated in the order in which they are defined, and only the first one with a matching condition is processed.

ELSE

The ELSE section defines a reference to an object that is processed if none of the WHEN-THEN items defined in the WHEN section was activated. The ELSE branch is optional. If it is not defined, and none of the conditions of the WHEN-THEN items evaluate to true, the Case object does not perform any action.


VoiceObjectsXML Definition

The Case object is represented by the VoiceObjectsXML element <case>. It has one attribute and five groups of children.

In addition, the element has the standard attributes described in the XDK Guide.

The <case> element uses the embedded <caseItem> and <else> elements.

Case

Attributes

·          caseValue
Defines the case comparison value. Must be a reference to an Expression, Layer, Script, or Variable object.

 

Children

·          <expression usage=”precondition”> or
<variable usage=”precondition”> or
<collection usage=”precondition”> or
<script usage=”precondition”>
Defines the precondition for the Case object.

·          <sequence usage=”preprocessing”>
Defines the preprocessing sequence for the Case object.

·          +<caseItem>
Defines the list of WHEN-THEN items.

·          <else>
Defines the object to be processed if none of the Case items evaluates to true.

·          <sequence usage=”postprocessing”>
Defines the postprocessing sequence for the Case object.

 

Example

<case caseValue=”#Number of calls”>

  <caseItem label=”Even” values=”2,4,6,8”>

    <output>

      <outputItem>

        <text>You called an even number of times.</text>

      </outputItem>

    </output>

  </caseItem>

  <caseItem label=”Odd” values=”1,3,5,7,9”>

    <output>

      <outputItem>

        <text>You called an odd number of times.</text>

      </outputItem>

    </output>

  </caseItem>

</case>

CaseItem

Attributes

·          label
A text string providing a name for the Case item.

·          values
Defines either a comma-separated list of constant values, or a reference to an Expression, Script, or Variable object. Either this attribute is defined, or the first child described below is defined, but not both.

 

Children

·          <expression usage=”condition”> or
<variable usage=”condition”> or
<collection usage=”condition”> or
<script usage=”condition”>
Defines an embedded object as condition for the Case item.

·          One of the following:
<module>, <input>, <output>, <sequence>, <menu>, <confirmation>, <list>, <osdm>, <plugin>, <connector>, <script>, <log>, <if>, <case>, <goto>, <loop>, <expression>, <recording>, <transfer>, <pause>, <exit>
Defines the object to be processed if the condition of this Case item evaluates to true.

 

Example

<caseItem values=”1,3,5”>

  <output link=”#Indicate odd number”/>

</caseItem>

 

<caseItem>

  <expression usage=”condition” link=”#isLeapYear”/>

  <output>

    <outputItem><text>The year is a leap year.</text></outputItem>

  </output>

</caseItem>

Else

Children

·          One of the following:
<module>, <input>, <output>, <sequence>, <menu>, <confirmation>, <list>, <osdm>, <plugin>, <connector>, <script>, <log>, <if>, <case>, <goto>, <loop>, <expression>, <recording>, <transfer>, <pause>, <exit>
Defines the object to be processed in the “else” case.

 

Example

<else>

  <output>

    <outputItem><text>The year is not a leap year.</text></outputItem>

  </output>

</else>

Object Interoperability

The following table contains all object types that can reference a Case object:


Icon

Object Name

Use Case Example

Module

A Case object can be used within the embedded sequence of a Module object.

Sequence

Most commonly, a Case object is used within a Sequence object in a dialog flow.

Menu

A Case object can be used as the destination object within a Menu item.

Confirmation

A Case object can be used as the destination object within a Correction item inside a Confirmation object.

If

A Case object can be used within either the THEN or the ELSE item of an If object.

Case

A Case object can be used in any WHEN item of other Case objects.

Loop

A Case object can be used within the embedded sequence of a Loop object.

Goto

A Case object can be referenced via a Goto object.

Hyperlink

A Case object can be the destination of a Hyperlink object.

Object Naming Conventions

In order to leverage the capabilities of the integrated documentation of VoiceObjects it is important to provide intuitive and self-explanatory object names and descriptions.

The name of a Case object should indicate the condition that is evaluated. The short description should contain a brief explanation of the types of cases that may occur. The long description should list all the various cases (WHEN items) that may occur. The table below lists three examples:


Name

Description

* Switch on caller status

Switches to different dialog flows depending on whether the caller is green card, gold card, or platinum card member.

* Offer special rebate

Offers various rebates to the caller depending on the insurance fee retrieved from the DB.

* Switch on caller age

Switches to different dialog flows depending on whether the caller is under 18, between 18 and 21, or over 21.