Create Conditional Mappings

The if and choose statements are two ways to create conditions. If statements allow you to specify a single condition. Choose/when/otherwise statements allow you to specify multiple conditions, similar to if/then/else.

To create conditional mapping:
  1. Drag a source to a target to create a mapping.
  2. Click View link, then select Advanced.
  3. In the upper right corner, click function icon to launch the Components panel.
  4. Expand XSLT, and drag appropriate XSLT statements onto the target element.
    You can either search or browse for the function.
  5. Drag the if or choose function onto the target element. (for this example, an if statement is dragged to an ID element).
    An if statement is dragged onto the ID target element.
    The if statement is displayed.
    An if statement is highlighted in blue in the Target data structure

  6. If you add a choose statement, you may specify additional when and otherwise conditions.
    A choose statement is selected (indicated by a green arrow) in the Target data structure

    1. Highlight the choose action, then drag and drop a when or otherwise statement.
      when statement added to the Target data structure

  7. Click Close, then apply your changes when prompted.

Set Default Values in the Mapper

You may have scenarios in which you need to set some fields to default values. The mapper contains a set of functions that you can use to set default values (for example, the when function that you can use to set default values).

For example, the following conditional mapping is performed.
Description of jet_map_choose_code2.png follows
Description of the illustration jet_map_choose_code2.png

In the payload, you can set the default value in the mapper.


The payload impacted by the statement

This syntax checks if the iD node is present in the payload. If so, it assigns that value. Otherwise, it adds the default value, which in this case is 1000.