Nav

Choice XML Reference

A Choice flow control component follows the structure described below.

  • A single root element <choice>

  • A <when> child element for each routing option, each with an expression to match.

  • Optionally, an <otherwise> child element of choice, that handles all cases where none of the expressions on the <when> elements evaluate to True.

  • Components that are conditionally executed under each of the choices are defined as child elements of the when and otherwise elements.

Properties of <when>

Property Description

Expression (expression)

Expression in DataWeave language to evaluate input. If the expression evaluates to true, this routing option is used.

Business Events

For activating the Business Events feature.


         
      
1
2
3
4
5
6
7
8
9
10
11
12
<choice doc:name="Choice">
  <when expression="#[vars.language == 'french']">
    <set-payload value="Bonjour!" doc:name="Reply in French"/>
  </when>
  <when expression="#[vars.language == 'spanish']">
    <set-payload value="Hola!" doc:name="Reply in Spanish"/>
  </when>
  <otherwise >
    <set-variable variableName="language" value="English" doc:name="Set Language to English"/>
    <set-payload value="Hello!" doc:name="Reply in English"/>
  </otherwise>
</choice>

In this topic:

We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used and to tailor advertising. You can read more and make your cookie choices here. By continuing to use this site you are giving us your consent to do this.

+