Pre-/Postprocessing

Overview

Pre- and postprocessing can be used to define single objects or sequences of objects to be processed before or after a certain object, respectively. The advantage is that whenever the object is used in the dialog flow, its embedded pre- and postprocessing objects are always automatically processed along with it. The effect is the same as if the preprocessing objects were put in the dialog flow right before the affected object, and the postprocessing objects right after it.

i8Note: In objects like Menu or Confirmation, the postprocessing objects will not be processed if, after selecting an item, the dialog flow never returns to the original object, e.g. due to a hyperlink or a Goto object being processed.

Pre- and postprocessing includes the definition of preconditions evaluated before processing an object (see below).


Defining a Precondition

In the Precondition Declaration section a precondition can be defined, that is evaluated before processing an object. The object is only processed if its precondition evaluates to true. Preconditions can be defined either by specifying an embedded expression, or by linking an Expression, Variable, Collection, or Script object. In this case, the precondition is true unless the return value of the linked object is an empty string, 0 (zero) or FALSE (in any combination of upper and lower case letters).

You can also use a layer condition as a precondition. In this case, select Layer condition as the function and link the layer condition as first argument. For more details on this, refer to the Expression object in this Object Reference.

By using preconditions dialog flows can be designed to allow dynamic object processing during call time. As an example, an Input object might be processed only in case the information it asks for is not yet available.

The following example is part of the Prime Insurance application. In the Car Insurance module, the caller is asked for the make and model of his or her car. The caller can either respond with the make only, or both make and model. The precondition of the Ask for model Input object checks if the content of the Car Model Variable object is empty. Only then does the Input object get processed. If the caller responded with the make and model, the Ask for model Input object is skipped.



For more information on the expression functions and on the definition of a precondition expression, see the Expression object in this Object Reference.

Defining Pre-/Postprocessing

In the Pre-/Postprocessing section (represented by a tab in Desktop for Web), single objects or sequences of objects can be specified to be processed before or after the object itself. This feature may be used, for example, to initialize parameters used within the object or to apply operations on the result provided by the object.

To specify objects to be processed before a particular object, use the Preprocessing section.

For objects to be processed after a particular object use the Postprocessing section.

In the Dialog Designer, objects with a pre- or postprocessing definition are indicated by a red dot at the top left  (for preprocessing) or bottom left  (for postprocessing) corner of its icon (see also Chapter 5 – Dialog Designer in the Desktop for Eclipse Guide or Desktop for Web Guide).

The actual sequence of objects specified can be displayed in the Dialog Designer by a setting in the display options, as described in Chapter 7 – Basic Commands in the Desktop for Eclipse Guide or Desktop for Web Guide.

VoiceObjectsXML Definition

Pre-/postprocessing

Pre- and postprocessing objects are defined using <sequence usage=”preprocessing”> and <sequence usage=”postprocessing”> children, respectively.

As an example for postprocessing, see the following excerpt of an Input object definition:

<input name=”Ask for car manufacturer”>

  ...

  <sequence usage=”postprocessing”>

    <log link=”#Car manufacturer”/>

  </sequence>

</input>

Preconditions

Preconditions are defined using <expression usage=”precondition”>, <variable usage=”precondition”>, <collection usage=”precondition”>, or <script usage=”precondition”> children.

As an example of using an Expression object as a precondition, see the following excerpt of an Input object definition:

<input name=”Ask for car model”>

  <expression function="isnull" usage="precondition">

    <argument object="#Car model"/>

  </expression>

  ...

</input>