> ## Documentation Index
> Fetch the complete documentation index at: https://docs.arc.cdata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Using the Condition Editor

> How to use the Condition Editor in CData Arc to add conditional logic to destination nodes in mappings.

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. The editor also enables you to set the value of a destination node based on values from the source. You can build complex conditions by adding individual rules and/or groups of rules, then specifying what action the mapping should take when the condition is satisfied.

To open the editor, hover over a node in the destination document and click the filter ![filter](https://mintcdn.com/cdata-arc/d_uxoDpYg8BiVilE/26.4/images/xmlmap_condition_icon.png?fit=max\&auto=format\&n=d_uxoDpYg8BiVilE\&q=85\&s=94cee88be3a9e2fdb0b194e5a02342f3) icon.

![](https://mintcdn.com/cdata-arc/mPTGrzt-QAW42BUU/26.4/images/edi_condition_editor.png?fit=max\&auto=format\&n=mPTGrzt-QAW42BUU\&q=85\&s=03aa98d325c55b06e574193cef63f43c)

Give the condition a name, then click **Add Rule** or **Add Group**. The **Value** field is pre-filled with the source element's XPath. Click into it to open a dropdown if you need to select a different source value.

![](https://mintcdn.com/cdata-arc/mPTGrzt-QAW42BUU/26.4/images/edi_condition_first_rule.png?fit=max\&auto=format\&n=mPTGrzt-QAW42BUU\&q=85\&s=b2227c85807a406bbcc1be077ac1b8a3)

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)

The right side of each rule (after the operator) has its own source dropdown. In addition to the sources available on the left side, it includes **Static Value**, which is only available on the right:

* **Static Value** (default): A free-text input for a literal comparison value. Only available on the right side.
* **Input XML**
* **Message Header**
* **Variable**

There are some restrictions on the right-side dropdown:

* The source dropdown is locked to **Static Value** when the operator is **contains**, **starts with**, **ends with**, **matches glob**, **matches regex**, **is in**, or **is not in**, or when the left-side type is **Index** or **Occurrences**
* The right side is hidden entirely when the operator takes no value: **is empty**, **is not empty**, **is null**, and **is not null**
* When the left-side type is **Data Type**, the right side dropdown shows a fixed set of options: **String**, **Number**, or **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.

![](https://mintcdn.com/cdata-arc/d_uxoDpYg8BiVilE/26.4/images/xmlmap_condition_select.png?fit=max\&auto=format\&n=d_uxoDpYg8BiVilE\&q=85\&s=8d3f1292c895cb634a034f596e8066bc)

You can reorder rules and groups. Click the handle ![handle](https://mintcdn.com/cdata-arc/d_uxoDpYg8BiVilE/26.4/images/xmlmap_condition_handle.png?fit=max\&auto=format\&n=d_uxoDpYg8BiVilE\&q=85\&s=29b06331be6308858fbb8a3d38a42f2c) and drag the object to a new location.

When you have completed defining the condition, use the right-hand pane to specify what should happen when the condition is satisfied.

![](https://mintcdn.com/cdata-arc/d_uxoDpYg8BiVilE/26.4/images/xmlmap_condition_rightside.png?fit=max\&auto=format\&n=d_uxoDpYg8BiVilE\&q=85\&s=c4d0b12d4da40f23c741da75f47ac635)

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 the [Alerts](https://docs.arc.cdata.com/26.4/cloud/en/getting-started/administration/settings/alerts.md) page in a new browser tab, where you configure your email settings. If these are not configured correctly, email notification fails.

Finally, use the **Else** section of the right-hand pane to specify what should happen when the condition isn't satisfied.

Use the **Else, Set Action to** 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, or write expressions or custom scripts for it.

![](https://mintcdn.com/cdata-arc/d_uxoDpYg8BiVilE/26.4/images/xmlmap_condition_else.png?fit=max\&auto=format\&n=d_uxoDpYg8BiVilE\&q=85\&s=0a62730269fffba228d2532dadf7a119)

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](https://docs.arc.cdata.com/26.4/cloud/en/mapping/mapping-node-value-editor.md#lookahead) for more details on using lookahead syntax.

## Script Mode

You can use ArcScript syntax to specify custom conditions by toggling on the Script Mode toggle in the upper right corner.

### Script Mode in Mapping Conditions

Once you toggle script mode on, use the window to write your custom conditions, then use the right-hand pane 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

![](https://mintcdn.com/cdata-arc/yfA3o6U6SThtnLN0/26.4/images/edi_mapping_condition_script_mode.png?fit=max\&auto=format\&n=yfA3o6U6SThtnLN0\&q=85\&s=753dee1d52f4e775c2f3768033b7a207)

> [!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.
> * If you create an ArcScript condition that cannot be rendered in the designer, when you switch back to designer mode you are warned that Arc cannot render this configuration in designer mode. If you switch to the designer mode you lose all changes to the existing configuration.

#### Examples

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.

The following example compares an XPath to a [`_map` variable](../connectors/xml-map/xml-map-advanced#map-item) set earlier in the mapping. The `def(0)` formatter provides a fallback if the XPath value is absent before the comparison runs.

`[xpath(FST/FST01) | def(0) | greaterthan([_map.OverUnderShipQty])]`

> [!NOTE]
>
> This example uses Script Mode because `_map` variables are not available in the designer's right-side source dropdown. For comparisons between other dynamic values (such as XPath versus XPath, or XPath versus a message header or variable), you can use the right-side source dropdown in the Condition Editor designer instead of Script Mode.

This example filters by a date relative to today. Use this pattern when you need to check whether a date field falls within a window relative to the current date. For example, if `Datetime` is 2026-10-05 and today is 2026-09-28, `datediff('day')` returns 7, so the condition is satisfied.

`[xpath(Datetime) | datediff('day') | isbetween(0, 15)]`

`datediff('day')` returns the difference in days between the date field and today: positive for future dates, negative for past dates. `isbetween(0, 15)` is inclusive of both bounds, so the condition matches today through 15 days from now, and the negative values for past dates fall outside the range.

See [Formatters](https://docs.arc.cdata.com/26.4/cloud/en/scripting/value-formatters/formatters.md) for details on all of the ArcScript's formatters.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.