Skip to main content

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 EDIFACT 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.

When using the square bracket syntax for a business rule, 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>

If you are using the square bracket syntax with a search table and there is more than one instance of the segment type in the message, this syntax compiles a list of matching fields/segments, then iterates through the list and inserts each one separately into the table.

You can use the IntersectsList utility function to test whether certain values are found in the string returned by the square bracket syntax. For more details about IntersectsList , see Built-in Functions .

When you use square brackets, InterSystems IRIS 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 how to match all values in the FT1:12.1 and FT1:6 fields in a message.

<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