This article will describe and include an example of how to embed an external PDF file into an HL7 segment, specifically ADT_A01:2.3.1 OBX(). This can be useful when attempting to insert pictures or other external data into an HL7 message. In this example, the name of the PDF file to be embedded is provided in the incoming HL7 message in OBX(1):ObservationValue field.

12 4
4 11,011


Can anyone point me to an example of a DTL & Class method that can pull a base64 encoded PDF out of a MDMT02 message?

This is really asking for two things;

- how to make a DTL that extracts a specific subfield of an HL7 2.3 message into a message of its own,


- how to transform an base64 encoded document into its original binary form for writing to a file.

I'd also love to see an example of an HL7 2.n MDM^T02 ==> HL73.ITK2 non-coded CDA

0 3
0 2,971

Two fairly common requests we receive from HL7 customers are (1) how to remove all trailing delimiters for fields and segments in HL7 messages and (2) how to "find and replace" for an entire HL7 message (as opposed to one segment/field at a time). The code sample below shows a custom function that solves for item 1 and by extension item 2 above. In other words the same approach can be used for finding/replacing any sequence of chars in an entire HL7 message, with some tweaks to the custom function.

7 6
0 2,915

So this may sound trivial, but I'm seeing conflicting information on this topic and hoping to get clarification.

According to Enslib.HL7.Message class definition, the maxlength of RawContent is 10,000 characters. So when using encoding like UTF-8, that is 10KB. When using Unicode, that should then be 20KB.

But then also coming across some forums and documents where 32KB is maximum size before HL7 fields are truncated.

What is the sure way to determine and modify an interface's maximum supported message size?

0 6
0 2,743

For testing purposes, I would like to create an EnsLib.HL7.Message from either a %String or a file on disk and pass it into a function in a unit test (outside of an Ensemble context). EnsLib.HL7.Parser appears to do the necessary parsing, but it also sends the message via Ensemble service rather than returning it as a value. Is there a way to leverage the parsing outside of a Ensemble service? Alternatively, is there another way to create an EnsLib.HL7.Message?

1 4
0 2,406
Yuriy Borokhov · Apr 1, 2017
XML to Json conversion


Are there any utilities/api in HealthConnect 2016.2.1 that will allow conversion of XML virtual document to Json format? We were thinking to convert HL7 ADT message to XML via Ensemble DTL and then send it to another BP to convert to Json format for transmission via Web Services. To my understanding there isn't anyway to represent Json as a virtual object so it can be use for direct mapping of HL7 2.x message to Json via Ensemble DTL.



0 3
0 2,326

Way back when during our Siemens LCR days we had to limit the number of characters in OBX.5 to a length of 75. That was back when we had eGate.

Now I need to do the reversal of that and take loop through a string length and split the string up into multiple OBX or NTE based on a certain length. In reading documentation $EXTRACT can do this if you know the exact length, but in this case we don't.

So how would one loop through a string and say every 75 characters create a new OBX or NTE segment?



1 6
0 2,017

EnsLib.HL7.Message.cls provides many API methods for manipulating an HL7 message. RemoveSegmentAt(), for example, can be used to remove a segment by path or index, but only one segment at a time. There may be times that you'll need to remove all segments within a group or even many groups of segments from the HL7 message. Surely you can iterate through each segment in each group and remove them one by one, but there's a much easier way.

With just one command, like below, you can remove all OBX segments in an ORU_R01 message (msg):

3 1
0 1,973

DTL Transformations and GetValueAt/SetValueAt calls on HL7 messages will truncate any fields longer than 32K. To avoid this, the methods GetFieldStreamRaw and StoreFieldStreamRaw must be used when dealing with fields that might be larger than 32K. OBX:5 is a frequent example. These methods have some subtleties and must be used carefully.

This can't be done by simply dragging from left to right in a DTL. It must be done with a code action. Also, the StoreFieldStreamRaw call must be the last edit made to the segment because the segment becomes immutable after that.

8 6
3 1,933
Scott Roth · Jun 19, 2017
Date Filtering Functionality

I have come across several cases where I need to set a Date filter to send only send any admit/scheduled date past a certain point. We have a couple different date comparison functions but none looking at the true date. Most of them are date + 15 or etc. Does anyone have a good date function they have written to say if x > 20170102 ?



0 14
0 1,786
Surya Sekhar Yerram · Mar 17, 2017
Convert HL7 to FHIR

Hello Greetings-

I am exploring on converting HL7 to FHIR.

1. I saw there are built in DTLs “FHIR.FromSDA” and “FHIR.ToSDA” to convert SDA -> FHIR and FHIR -> SDA. Similarly Do Intersystems have DTLs for HL7 -> FHIR and FHIR -> HL7?

2. The reason why I am asking is, I see in HSLIB namespace HS->GateWay->HL7->HL7toSDA3 and HS->GateWay->SDA3->SDA3toHL7 DTLs. Like-wise I am trying to locate HL7 -> FHIR and FHIR -> HL7. Please help me to locate them

1 3
2 1,771
Brendan Batchelder · Sep 20, 2016 4m read
Diagnosing Framing Errors

Framing refers to the characters that mark the start and end of an HL7 message (or other types of framed messages). Most HL7 services and operations have a Framing setting that allows the user to define this framing. The most common choices are available as defaults, but with the AsciiMM/NN setting, components can be configured to recognize any framing characters.

4 0
2 1,759

Hello Gentlemen,

My Business process connector receive a Oru_01 hl7 message with an ED segment inside (Base64 pdf). How is it possible to extract it and create a pdf file within?

Here is the sample of function I have. I know it doesn't work but if you could help me, it would be perfect. Here is my function, the goal would be it create the file where I want and return me the link of the file.

0 5
0 1,487


I have a ORU message, which has a EVN segment that I want to remove and send the message across.

I tried to clone the request as below:

s newreq = request.constructClone

s changreq = newreq.RemoveSegmentAt("EVN")

Set request = changereq

but it fails. Is there a way that I can safely remove a segment and pass it on?

Would appreciate your help in this



0 12
0 1,275

Hi ,

I'm using standard business service not(Customized business service). I'm not able to process the Hl7 data file which contains CRLF characters.It shows warning "Discarding Received non HL7 data". Actually it discards some segment after CRLF character. Is there any settings to overcome this problem?

Also i tried UTF-8, Ascii,Unicode.. characterset . But it won't work. Please help me .


0 10
0 1,163
Ewan Whyte · Feb 21, 2018
HL7 segment query using SQL

I'm trying to get a count of specific message type with a specific entry and thought I could build the query in Message Viewer but this does not provide counts (as far as I am aware). So when I take the SQL from 'Show Query' it omits the segment criteria as the code shows below.

I have attached the criteria that has been excluded. Is this possible?

Thank you

0 2
0 1,130
Scott Beeson · May 17, 2016
Tools for CDA/CCD?

I have a tool I absolutely love for HL7 v2 analysis and manipulation. It's called 7edit. I'm wondering if there is anything similar for HL7v3/CDA/CCD. I know it is considerably more complex, but I still have hope.

So far the best resource I've found is I'd love to hear anyone else's tips for tools or resources.

1 1
0 1,126
Kurro Lopez · Dec 19, 2016
HL7 Section to JSON

Hi all,

I'm trying to convert a HL7 section to a XML or JSON string.

We need to save the content of PID section into a SQL Column, therefore we need to convert it into a XML o JSON string

is there any easy way to convert it?

I've tried to convert it directly into a DTL, but all my attempts have been unsuccessful

Best regards,

Francisco Lopez

0 6
0 1,125


InterSystems has recently completed a performance and scalability benchmark of IRIS for Health 2020.1, focusing on HL7 version 2 interoperability. This article describes the observed throughput for various workloads, and also provides general configuration and sizing guidelines for systems where IRIS for Health is used as an interoperability engine for HL7v2 messaging.

5 3
3 1,101


1) What's the correct way to check for an existence of a segment? So far I have been doing this by checking to see if a required field is non-null, and this seems to work but is a bit clumsy. In this case, it’s an X12 message being checked in an IF action in BPL:


Or in a DTL, to see if a Z segment exists:


0 3
0 1,083


We have created an Ensemble production that receives HL7 information via TCP Adapters, but the requirement from the vendor is that we submit an ACK message with the MSH segment mist have a date and time populated with seconds.

We are utilising the standard class for the Service Adapter (EnsLib.HL7.Service.TCPService).

HL7 Version 2.5 no modifications currently.

The messages received via the service is correctly received in ddMMyyyyhhmmss but our ACK back is only ddMMyyyyhhmm.

0 1
0 1,062