Surrounding a Component With a Choose Statement

Choose statements enable you to conditionally specify the mapping based on an expression. Choose statements consist of a When clause to specify the condition you want to test, the mapping you want to perform if the condition is true, and an Otherwise clause to contain a mapping to perform if no conditions evaluate to true.

Procedure

  1. Select the component to surround, right-click, and choose Surround > Surround with Choose... from the menu.
  2. In the Surround With Choose dialog, enter the number of When conditions to test against, and also specify whether to include an Otherwise clause for any unhandled conditions.
  3. For each When clause, create an XPath expression that evaluates to a boolean.
  4. Under each When clause, provide the XPath expression for the mapping that occurs if the When condition evaluates to true.
  5. If an Otherwise clause is specified, provide an XPath expression for the mapping that occurs if no When conditions evaluate to true. An example of using a Choose statement is when more than one fault message is handled by the same Catch Fault task. The figure below shows a Transform task on a fault path that handles two faults. The Choose statement specifies that when the searchHotel_faultMsg is returned, send the value of the searchHotel_fault element. Otherwise, send the value of the message element.
    An example of choose statement