Sidebar

syntax error on HL7 hpath

0 votes
266 views
asked Jul 23, 2021 by nickie-l-1757 (200 points)
hello,

I'm trying to write a getNode using a hpath test on the 1st subfield of a repeating of NTE[1]-3 and return the 2nd subfield of that repeating group

In my test data it is in NTE[1]-3.1[3].2

I trying to use the path NTE[1]-3.1[@1=DateofIllness].2 so as to not hardcode the index

but I get an invalid field index of '@1=DateofIlness' ...any help on whats wrong with my systax would be appreciated

1 Answer

0 votes

Unfortunately, the repeating elements in the HL7 are not supported by the hpath. I will enter an enhancement to see if this can be supported.

However using stringUtils we can support you finding this value using the code below.

//define variable for nte3.2 value when found
var nte32DateOfIllness = '';
// Split the nte=3 segment into seperate values
var nte3split = StringUtils.splitByWholeSeparator(message.getNode('NTE-3'), '~');
//Loop through each NTE-3 value and look for Dateofillness
for (var i = 0; i < nte3split.length; i++) {
   //split the value into separate strings
   var nte3valueSplit = StringUtils.splitByWholeSeparator(nte3split[i], '^');
   //Evaluate if this is the value we want
   if (StringUtils.equalsIgnoreCase(nte3valueSplit[0], 'Dateofillness')) {
      //if Dateofillness is found in nte-3.1 then set nte32DateOfIllness to nte-3.2
      nte32DateOfIllness = nte3valueSplit[1];
   }
}
qie.debug(nte32DateOfIllness);

answered Jul 23, 2021 by brandon-w-8204 (33,270 points)
...