Question
· Jul 13, 2020

Identifying HL7 Segment Schema Path?

If you're viewing a HL7 message in the front end, with a schema correctly applied, you can mouse over a segment or a field and see the schema path, e.g:

Mousing over PV1 in the above message shows the schema path is "PIDgrp(1).PV1".

I'm writing a utility function which you pass an EnsLib.HL7.Message into. I'd like to loop through each segment and take action dependant on that schema path. How can I reference or determine that schema path in code?

Any help would be much appreciated!

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

Sorry, never mind, figured it out.

Where pHL7 is the EnsLib.HL7.Message, execute:

do pHL7.BuildMap(0)

After that, reference pHL7.GetSegmentPath(*) to get the schema path (replacing * with the segment number, e.g. in the screenshot in my original post, PV1 was row 5, so pHL7.GetSegmentPath(5) = "PIDgrp(1).PV1").

For my loop I'm referencing pHL7.SegCount, e.g:

i=1:1:pHL7.SegCount pHL7.GetSegmentPath(i),! }