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. The result of the root of the expression tree is the value of the output element in a map. If the value expression is specified for a structure element, it is copied to the corresponding map element as the default value. When the structure is use as an output structure in a map its value expression defines the default value for the output. When the structure is used for an input structure, the structure element value is used as a default value by some representation readers (like Java) to contain metadata. The input value expression is not intended to be modified in the map and is only present to reflect the value expression from the corresponding structure element.
Loop - For an output map element, defines how the element loops. The root of this expression tree must be a loop function.
Validate - Allows arbitrary validation logic to be associated with the element. When the result of this expression is false, a validation error is reported.
Emit - Defines the conditions where this element is emitted (forced to appear) when the element is optional or a member of a choice. An element is optional if it occurs between 0 and 1 times. If the result of this expression is true, or if the expression is not specified, the element is emitted, otherwise it is not. This is useful when the optional element needs to be emitted based on some special condition. However, most of the time it is not necessary, since an optional element with an empty value will automatically not appear.
This is also useful in the case of a choice. For example when using XML and mapping to an XML Schema Type that has other types which extend from it. In this case the xsi:type attribute contains the type of the actual elements that appear in the input document. An Emit expression can refer to the xsi:type value. When elements from a member of the choice are mapped somewhere to the output the Emit expression from the input is automatically copied to the enclosing member in the output allowing the output member to be selected based on the type of the input. Emit expressions are automatically generated on the input side of maps for the purpose of copying to the output side to have the output sense the choice condition from the input (as explained above).
Emit expressions are automatically generated to associate output containing map elements with their corresponding input map elements when elements are mapped.
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 which data to process and which to skip. Generally the IsPresent expression is not necessary for XML, Java, and database representations, as they are able to determine which elements to provide based on the input data. There are some restrictions on what can be specified in this expression tree:
Aggregate functions may not be used.
When referencing an element, it will be 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.
Violations of these restrictions will result in an error when the map or structure is executed.
Null - Determines when to emit this output map element as a null value. 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). Non-container elements can get null values simply by using the Constant function.
Null values are carried through from input to output for those representations that support them (Java, XML and database). If the both the input and output elements have the Null element property set, and the input element's value is null, when mapped, the output element's value will be null.
Null expressions are automatically generated to associate output containing map elements with their corresponding input map elements when elements are mapped.
IO/Database - Provides input/output operations, which for example redirect the reading or writing to another document instance. Also provides database functions, which control how the element interacts with the database. The DatabaseJoin and DatabaseSelect functions are used here.
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 to predefine loop expressions for example in the structure and have all maps that use that structure use the predefined loop expression. The map is also free to override that by providing its own loop expression tree for the given element.
When an input element is mapped to an output map element, the Loop and Emit expression trees are copied from the input map element to the output map element. This continues the idea of creating default expressions to be used for these categories that are associated with the input.