Skip to main content

This version of the product is no longer supported, and this documentation is no longer updated regularly. See the latest version of this content.Opens in a new tab

Square Bracket [ ] Syntax

Describes how to use square bracket [ ] syntax to access virtual properties.

Where Applicable

You can use this syntax in business rules, search tables, and search filters. This syntax is available for ASTM, EDIFACT, HL7 version 2, and X12 documents.

Details

To use square bracket [ ] syntax to access a virtual property, use the following syntax:

[myVirtualPropertyPath]

Where myVirtualPropertyPath is a virtual property path as described earlier in this reference, except that field identifiers must be in numeric format.

This syntax finds values in named segments regardless of message structure. If there is more than one instance of the segment type in the message, this syntax returns a string that contains all matching values, each value enclosed in <> angle brackets. For example, if the syntax returns multiple values a, b, and c, they appear in a single string like this:

<a><b><c>

When you use square brackets, Ensemble can resolve the numeric path without knowing the specific message structure or schema. This is different from curly brackets {} which require you to identify the message structure. For example, a DTL data transformation identifies the message structure of the source and the target messages with attributes of the <transform> element (sourceDocType and targetDocType) so that you can use curly bracket syntax.

Square bracket syntax supports the repeating field shortcut () only in the field portion of the property path (segment:field).

Example

The following excerpt from a search table class shows two valid ways to match all the FT1 segments found in a message that contains several FT1 segments:

<Items>
  <Item DocType="" PropName="TransactionAmt">[FT1:12.1]</Item>
  <Item DocType="" PropName="TxType">[FT1:6]</Item>
</Items>

Comparison to FindSegmentValues()

The syntax is similar to but does not equate directly with the default behavior of FindSegmentValues(). Instead, it modifies the separator and encloses the result in angle brackets, so the square bracket syntax equates to the following method call:

"<"_msg.FindSegmentValues("segment:field",,"><")_">"

FeedbackOpens in a new tab