1. I would stay away from Modifying the current EnsLib.HL7.SearchTable if at all necessary. Modifying the source code could lead to consequences down the road, especially when you upgrade it might get overwritten. What I did was that I copied the existing code and modified it for our use. That way we can add and remove fields anytime we want.

Class osuwmc.HL7SearchTable Extends (%Persistent, Ens.VDoc.SearchTable) [ ClassType = persistent, CompileAfter = EnsLib.HL7.Message, Inheritance = right, ProcedureBlock, System = 4 ]


Parameter DOCCLASS = "EnsLib.HL7.Message";

Parameter EXTENTSIZE = 4000000;

/* Re-declare indices because the superclass is abstract */

Index indexValue On (PropId, PropValue, DocId) [ IdKey, Unique ];

Index indexDocId On (DocId, PropId, PropValue) [ Unique ];

XData SearchSpec [ XMLNamespace = "http://www.intersystems.com/EnsSearchTable" ]



<Item DocType=""  PropName="MSHTypeName" Unselective="true">{1:9.1}_"_"_{1:9.2}</Item>

<Item DocType=""  PropName="MSHControlID" PropType='String:CaseSensitive' >{1:10}</Item>

<Item DocType=""  PropName="PatientID"   >[PID:2.1]</Item>

<Item DocType=""  PropName="PatientID"   >[PID:3().1]</Item>

<Item DocType=""  PropName="PatientID"   >[PID:4().1]</Item>

<Item DocType=""  PropName="PatientName" >[PID:5()]</Item>

<Item DocType=""  PropName="PatientAcct" >[PID:18.1]</Item>

<Item DocType=""  PropName="Order#"      >[ORC:2.1]</Item>

<Item DocType=""  PropName="Order#"      >[SCH:26.1]</Item>

<Item DocType=""  PropName="Order#"      >[ZOR:1]</Item>

<Item DocType=""  PropName="Accession#"  >[ORC:3.1]</Item>

<Item DocType=""  PropName="SIUVisitType">[AIS():3.1]</Item>

<Item DocType=""  PropName="SIUProvider#">[AIP():3.1]</Item>



Storage Default


<Data name="HL7SearchTableDefaultData">

<Value name="1">













I do something similar to what you are trying to do, I Decode the PDF, save the PDF locally, and return a path to the DTL.

Several on the developer community helped me figure this out...

ClassMethod DecodeBase64HL7ToFile(base64 As %Stream.GlobalBinary, Ancillary As %String, FileName As %String) As %String


    set ArchDir = "/ensemble/data/transfer/AncillaryPDF/"

    set ArchAncDir = ArchDir_Ancillary_"/"

    set FaxDateDir = ArchAncDir_$PIECE($ZDATE($HOROLOG,7)," ",1)_"-"_$PIECE($ZDATE($HOROLOG,7)," ",2)_"-1/"

    if '##class(%Library.File).DirectoryExists(ArchDir)


        do ##class(%Library.File).CreateDirectory(ArchDir)


    if '##class(%Library.File).DirectoryExists(ArchAncDir)


        do ##class(%Library.File).CreateDirectory(ArchAncDir)


    if '##class(%Library.File).DirectoryExists(FaxDateDir)


        do ##class(%Library.File).CreateDirectory(FaxDateDir)




    set Oref = ##class(%FileBinaryStream).%New()


    set Oref.Filename = FaxDateDir_FileName

    Do base64.Rewind()

    While 'base64.AtEnd {

        set ln = base64.ReadLine()

        set lnDecoded = $system.Encryption.Base64Decode(ln)

        do Oref.Write(lnDecoded)


    Do Oref.%Save()

    set PDFFilePath = FaxDateDir_FileName

    return PDFFilePath


You could use Piece to separate the values in Par_Locations.

We have used Length many times in Routing rules to check to see if Admit/Discharge date exists. We haven't quite used HL7.{PV1:45} to get the field, we let the system spell it out for us... so instead of HL7.{PV1:45} we allow the system to put it in the nomenclature that it knows the field as.. in this case HL7.{PV1:AdmitDateTime.Time}

Nicole, I believe your problem is with the repeating fields. You can not leave () blank. You will need to use a counter or loop through OBX to look for the individual fields you are looking for.


I would believe the only way to put a schema filter in would be within your query and not in the connection string.

I found with create a Inbound BS, you can't really use the Delete query as an update statement. Either you place the update statement within your BPL, or truly make the Delete query a Delete query on your inbound service.

Make sure you are also using EnsLib.RecordMap.Operation.BatchFileOperation as your operation and you define the header in it as well. 

Have you used JDBC drivers before? I have a couple of connections that I have created through JDBC to connect to Oracle to pull data from an Oracle table to create an HL7 message. Currently we are using the Oracle JDBC driver to connect to the Oracle system. 

I figured it out on my own. 

It did not like

<assign value='source.GetFieldStreamRaw(.tStream,"ORCgrp(1).OBRgrp(1).OBXgrp(k1).OBX:ObservationValue(1).AlternateText}",tRemainder)' property='tSC' action='set' />

I had to change it to 

<assign value='source.GetFieldStreamRaw(.tStream,"ORCgrp(1).OBRgrp(1).OBXgrp("_k1_").OBX:5.5",.tRemainder)property='tSC' action='set' />