Question
Larry Overkamp · Jun 1, 2018

Variable as repeating field index in property path

Ensemble 2017.2.

I am writing a DTL code action based on the solution described in the posting "How to avoid truncation in HL7 messages with very large fields (32K+)". Because the source value is in a repeating segment, and the specific repetition in which the value is located can vary, I would like to use a variable (specifically the k1 key) to specify the repetition to get.  I have been unable to get it to work.

OBXgrp is the location in the path at which the repetition occurs. Hard-coding an index, as in the example below, works.

do source.GetFieldStreamRaw(.stream, "PIDgrpgrp(1).ORCgrp(1).OBXgrp(3).OBX:5.1")

However, if I use k1 instead, as in the example below, it fails to retrieve the data.

do source.GetFieldStreamRaw(.stream, "PIDgrpgrp(1).ORCgrp(1).OBXgrp(k1).OBX:5.1")

How can a variable be used as a repeating field index in a property path?

0
0 298
Discussion (1)2
Log in or sign up to continue

Hi Larry,

In a code rule, you'll need to concatenate the path string with the k1 variable, as such:

do source.GetFieldStreamRaw(.stream, "PIDgrpgrp(1).ORCgrp(1).OBXgrp("_k1_").OBX:5.1")