Using the Condition Mapping Editor

Version 23.4.8841


Using the Condition Mapping Editor


The Condition Mapping Editor supports adding conditions to destination nodes so that they are only included in the output document if the condition is true. You can build complex conditions by adding individual rules and/or groups of rules, then specifying what action the connector should take when the condition is satisfied.

To open the editor, hover over a node in the destination document and click the filter filter icon.

The editor modal in divided into sections. On the left side, you can:

  1. Name your condition: This makes your mapping more readable by letting you include the condition name (instead of the entire condition) in the Mapping Editor.
  2. Define the rules or groups of rules that must be met to satify the condition.
  3. See the destination node you are defining the condition for (the Mapping).

On the right side, you can:

  1. Set the status of the message.
  2. Send notifications.
  3. Add Else conditions to your mapping. You can exclude the element, map the value anyway, or map a different value altogether.

To add a condition, click Add Rule or Add Group.

When you build your rules, use the dropdowns to make your selections. You can choose from the following:

  • Input XML
    • Value: The value at the XPath being evaluated
    • Data Type: The data type of the value (String, Number, DateTime)
    • Occurrences: The number of times the XPath occurs in the document
    • Index: The index representing the current iteration of the Foreach loop that is being evaluated
  • Message Header
    • Value: The value of the message header being evaluated
    • Data Type: The data type of the value (String, Number, DateTime)
  • Variable
    • Value: The value of the variable being evaluated
    • Data Type: The data type of the value (String, Number, DateTime)

When you select an XPath for a condition, the editor displays a tree representation of the document so you can easily find the XPath you need, as shown in the image below.

You can reorder rules and groups. Click the handle handle and drag the object to a new location.

When you have completed defining the condition, use the right side of the modal to specify what should happen when the condition is satisfied.

Choose a status of:

  • Success
  • Warning
  • Error

Check Send a Notification and complete the To and Subject fields to send an email about the status of the condition.

Note: Click Configure Alerts to open a new browser tab where you can set the Email Settings on the Alerts tab of the Settings page. If these have not been configured correctly, email notification fails.

Finally, use the Else section of the modal to specify what should happen when the condition isn’t satisfied.

Use the Mapping dropdown to choose whether to:

  • Exclude Element from the mapping altogether
  • Map Value to map the value anyway
  • Assign a Different Value to assign a different value (defined as an expression or custom script once you save the condition)

The status and notification options work in the same way as the top section.

When you save the condition, it appears in the mapping editor and behaves in the same way as any other leaf node in the mapping. You can drag-and-drop an element from the source side, write expressions or custom scripts for it, etc.

Conditional logic can also be accomplished using lookahead syntax. Parent elements are often qualified by a child element that provides context to the values inside the parent. In these cases it might be easier to use lookahead syntax rather than create multiple conditions to exclude unwanted values. See Lookahead for more details on using lookahead syntax.

Custom Conditions

You can use ArcScript syntax to specify custom conditions. Click the Custom Script button to open the scripting window. When you have written your custom condition, use the right side of the page in the same way as described above to:

  • Set the status of the message
  • Send notifications
  • Add Else conditions to your mapping, including excluding elements from the mapping if the condition is not met

Note: The editor validates your condition as you type. If you see an Invalid Condition message, you have some sort of syntax issue that must be resolved.

One common use of the custom condition editor is to compare two dynamic values from the source document (instead of comparing a single dynamic value against a static value).

For example, you could use the following custom condition to see whether two values in the source XML are equal:

'[xpath(element1)]' == '[xpath(data/element2)]'

Note: The single quotes in the example above are required.

You can also perform boolean logic in custom conditions by using ArcScript formatters, as in the following example:

[xpath(element1) | equals([xpath(data/element2])])]

Notice that this syntax does not require single quotes.

See Formatters for details on all of the ArcScript’s formatters.