Hey Doug,

It's been a very long time :)

So ... no, you don't need a complex record map to do this, but the mechanism takes just a little more work using a "simple" record map. The record map feature doesn't let you set a Composite field as repeating, which is why we need to deal with those "grouped" OBX segments/fields using a different method.

What I've done is define the RecordMap with individual fields for everything before the first OBX field, and then define the rest of the record as a single, repeating field. You can then iterate over that last field and parse out the individual HL7 field values with $PIECE, or turn them into a $LIST and  reference the elements by numeric index. The only delimiters you'll need to set for the record map are a "|" as the field delimiter and a "~" for the repetition delimiter.

Here's a sample record map layout:

Along with setting OBXSegs as repeating, I set the MAXLEN DataType parameter to something large enough to accommodate all of the fields. Also note the Discard field; the sample data in your post included a leading "|," so that needs to be treated as though there's an initial empty field in each record. Including a dummy field to consume it makes things a bit more understandable when addressing the subsequent fields.

Here's one way you might iterate over the repeating record map field:

As you surmised in a follow-up to Nora's earlier posts, the Complex Record Map functionality is really only required when the record structure varies from line to line in the input data.

It's not normally a property of the message header or body objects. You can often find the port number in the Source property of the Body, but not the IP address. To get that, you'll need to look at the Event Log for the service. It will look something like this:

As for what you're doing wrong ... hard to say at this point; not much to go on. Does the connection complete successfully without restricting the allowed IP addresses?

If you don't care about any unsent/completed/suspended messages, try calling the CleanProduction() method in class Ens.Director:

Do ##class(Ens.Director).CleanProduction()

This is strongly discouraged for PROD environments ... be forewarned. Would recommend you contact the WRC if you're getting this error in a PROD environment.

@Robert C. Cemper has you on the right track, but I'm curious as to whether the vendor of the foreign (i.e. non-HealthShare/HealthConnect) system has provided a specification. Do you need to accommodate Acknowledgement messages for both sending/receiving? Is there some sort of handshake protocol that is used to indicate when it's safe to send, a sort of RTS/CTS-type mechanism? Or is this being designed "on the fly?"

If I were designing something like this, I'd go with a web service ... always over the same port, and when you want to send something you'd POST it. When there's nothing to POST, you'd periodically GET to see if anything is waiting.

Anything else would most likely be a one-off in healthcare integration.