Expression trees
Each expression tree has a purpose associated with its map or structure
element. The following expression trees are used:
- Value: Defines the value of the element. It can be an expression or a simple reference to a map element.
- Loop: Defines how an output map element loops. The root of this expression tree must be a loop function. For more information, see Loop expressions.
- Validate: Allows arbitrary validation logic to be associated with the element. When the result of this expression is false, a validation error is reported. For more information, see Validation expressions.
- Emit: Defines the conditions where this element is emitted (forced to appear) when the element is optional or part of a choice. If the result of this expression is true, or if the expression is not specified, the element is emitted, otherwise it is not. For more information, see Emit expressions.
-
IsPresent: Defines the conditions where
this element is considered to be present and therefore consumed by the input
processor. If this is omitted or true, the element is consumed, otherwise (if
specified and false) the element is ignored. This is used only for Flat (including COBOL) and EDI
, which must process a stream of data that is not self describing and thus
the reader needs additional information to describe what data to process and
what to skip. There are some restrictions on what can be specified in this
expression tree:
- Aggregate functions may not be used.
- When referencing an element, it returns the value in the current iteration of a loop.
- Any structure elements referenced must occur at or before the element containing the IsPresent expression in the element tree.
- Null: Determines when to emit this output map element as a Null. If the result of this expression tree is true, the element is emitted as a null value. The Null expression tree is present only for elements that are containers (element group type other than None). For more information, see Null expressions.
- IO/Database: Provides input/output operations, which for example redirect the reading or writing to another document instance. It also provides database functions, which control how the element interacts with the database. For more information, see Input/Output expressions.
- Util: Utility expressions associated with the output map element. Whatever is in the Util tab is executed before the map element is executed, so you can use the SetVariable function (and combine it with other functions if required).
Expression trees exist for structure elements and map elements. When an expression tree is defined in a structure element, it is copied to the corresponding map element. This allows you, for example, to predefine loop expressions in the structure and have all maps that use that structure use the predefined loop expression. You can also override that by providing a different loop expression tree for the given element in the map.