Developing DTL Transformations
This chapter describes the syntax rules for referring to properties and for creating expressions within various DTL actions. It contains the following sections:
References to Message Properties
In most actions within a transformation, it is necessary to refer to properties of the source or target messages. The rules for referring to a property are different depending on the kind of messages you are working with.
When you assign a value to a target property, you often specify a literal value. Literal values are also sometimes suitable in other places, such as the value in a trace
A literal value is either of the following:
Due to the limitations of single-byte encoding format for HL7, the numeric value in character codes in literal strings placed in HL7 messages can be no higher than the decimal value 255 or hexadecimal x00FF.
Because DTL transformations are saved as XML documents, you must use XML entities in the place of XML reserved characters:
"Joe's "Good Time" Bar & Grill"
This restriction does not apply inside code
actions, because Ensemble automatically wraps a CData block around the text that you enter into the editor. (In the XML standard, a CData block encloses text that should not be parsed as XML. Thus you can include reserved characters in that block.)
Separator Characters in Virtual Documents
In most of the virtual document formats, specific characters are used as separators between segments, between fields, between subfields, and so on. If you need to include any of these characters as literal text when you are setting a value in the message, you must instead use the applicable escape sequence, if any, for that document format.
These characters are documented in the applicable books. For details, see:
In a data transformation, the separator characters and escape sequences can be different for the source and target messages. Ensemble automatically adjusts values as needed, after performing the transformation. This means that you should consider only the separator characters and escape sequences that apply to the source
When XML Reserved Characters Are Also Separators
If the character (for example, &
) is a separator and you want to include it as a literal character, use the escape sequence that applies to the virtual document format.
You can include decimal or hexadecimal representations of characters within literal strings.
The string &#n;
represents a Unicode character when n
is a decimal Unicode character number. One example is é
for the Latin e character with acute accent mark (é).
Alternatively, the string &#xh;
represents a Unicode character when h
is a hexadecimal Unicode character number. One example is ¿ for the inverted question mark (¿).
When you assign a value to a target property, you can specify an expression, in the language that you selected for the data transformation. You also use expressions in other places, such as the condition for an if
action, the value in a trace
action, statements in a code
action, and so on.
The following are all valid expressions: