Syntax Rules
This chapter describes the syntax rules for referring to properties and for creating expressions within various BPL activities. It contains the following sections:
References to Message Properties
In activities within a BPL process, it may be necessary to refer to properties of the message. The rules for referring to a property are different depending on the kind of messages you are working with.
-
For messages other than virtual documents, use syntax like the following:
message.propertyname
Or:
message.propertyname.subpropertyname
Where propertyname is a property in the message, and subpropertyname is a property of that property.
-
For virtual documents other than XML virtual documents, use the syntax described in “Syntax Guide for Virtual Property Paths” in Ensemble Virtual Documents.
-
For XML virtual documents, see the Ensemble XML Virtual Document Development Guide.
Literal Values
When you assign a value to a property, you often specify a literal value. Literal values are also sometimes suitable in other places, such as the value in a trace action.
A literal value is either of the following:
-
A numeric literal is just a number. For example: 42.3
-
A string literal is a set of characters enclosed by double quotes. For example: "ABD"
Note:This string cannot include XML reserved characters. For details, see “XML Reserved Characters.”
For virtual documents, this string cannot include separator characters used by that virtual document format. See “Separator Characters in Virtual Documents” and “When XML Reserved Characters Are Also Separators.”
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.
XML Reserved Characters
Because BPL processes are saved as XML documents, you must use XML entities in the place of XML reserved characters:
To include this character... | Use this XML entity... |
---|---|
> | > |
< | < |
& | & |
' | ' |
" | " |
For example, to assign the value Joe’s "Good Time" Bar & Grill to a property, set Value equal to the following:
"Joe's "Good Time" Bar & Grill"
This restriction does not apply inside <code> and <sql> activities, 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:
-
“Separators” in the reference section of the Ensemble HL7 Version 2 Development Guide
-
“Separators” in the reference section of the Ensemble ASTM Development Guide
-
“Separators” in the reference section of the Ensemble EDIFACT Development Guide
-
“Separators” in the reference section of the Ensemble X12 Development Guide
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.
-
In all other cases, use the XML entity as shown previously in “XML Reserved Characters.”
Numeric Character Codes
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 (¿).
Valid Expressions
When you assign a value to a property, you can specify an expression, in the language that you selected for the BPL process. You also use expressions in other places, such as the condition for an <if> activity, the value in a <trace> activity, statements in a <code> activity, and so on.
The following are all valid expressions:
-
Literal values, as described in the previous section.
-
Function calls (Ensemble provides a set of utility functions for use in business rules and data transformations. For details, see “Ensemble Utility Functions” in Developing Business Rules.)
-
References to properties, as described in “References to Properties.”
-
Any expression that combines these, using the syntax of the scripting language you chose for BPL process. Note the following:
-
In ObjectScript, the concatenation operator is the _ (underscore) character, as in:
value='"prefix"_source.{MSH:ReceivingApplication}_"suffix"'
In Basic, the concatenation operator is & (ampersand).
-
To learn about useful ObjectScript string functions, such as $CHAR and $PIECE, see the Caché ObjectScript Reference. For Basic equivalents, see the Caché Basic Reference.
-
For a general introduction, see Using Caché ObjectScript or Using Caché Basic.
-
Indirection
Ensemble supports indirection in values for the following BPL element-and-attribute combinations only:
The at sign symbol, @, is the indirection operator.
For example, the <call> element supports indirection in the values of the name or target attributes. The name identifies the call and may be referenced in a later <sync> element. The target is the configured name of the business operation or business process to which the request is being sent. Either of these strings can be a literal value:
<call name="Call" target="MyApp.MyOperation" async="1">
Or the @ indirection operator can be used to access the value of a context variable that contains the appropriate string:
<call name="@context.nextCallName" target="@context.nextBusinessHost" async="1">
This book describes @ indirection syntax in the documentation of each element that supports it: <call>, <sync>, and <transform>.
BPL and DTL are similar in many ways, but DTL does not support indirection.