Ok, quick and dirty, try this

stream.Filename filename
propertyPath "PIDgrpgrp(1).ORCgrp(1).OBXgrp(1).OBX:5(1)"
tSC seg.StoreFieldStreamBase64(.stream,$P(propertyPath,":",2),,0)

set tSegString=""
    set tSegStringCleared="" 
    set tSegString = target.GetValueAt("
    set tSegStringCleared = $translate(tSegString,$c(13,10))
    set tSC = target.SetValueAt(tSegStringCleared,"target.{

I'll ask again so I understand you correctly. 

You want to have another OBX segment with each CRLF or another OBX:5(*) field?
More segments would create too much overhead. 
I think the IHE Radiology Profile recommends a new segment every 62k bit.

With repeated fields in OBX:5 it's not HL7 standard conform.

Or would you like an OBX:5 field with the value ABCDEFGHIJKL...

Hi, this is my method to remove the crlf. 
I check every stream and remove it. 

You could also change the operation, but the problem remains if you exchange data with other systems.

ClassMethod PDFfromBase64Stream(pFilename As %String, Base64Stream As %Stream.GlobalCharacter) As %Status
 set SGB1=##class(%Stream.GlobalBinary).%New()
 set SGB2=##class(%Stream.GlobalBinary).%New()
 set FBS = ##class(%Stream.FileBinary).%New()
 set sc = FBS.FilenameSet(pFilename)
 Do FBS.Rewind()
 Do Base64Stream.Rewind()    
    while 'Base64Stream.AtEnd{
        set temp=Base64Stream.Read()
        set temp=$translate(temp, $c(13,10))
        set temp=$REPLACE(temp, "\r\n","")
        do SGB1.Write(temp)}
do SGB1.Rewind()
    while 'SGB1.AtEnd{
        set temp=SGB1.Read(5700)
        set temp=$system.Encryption.Base64Decode(temp)
        do SGB2.Write(temp)}
do FBS.CopyFrom(SGB2)
set sc = FBS.%Save()
quit sc

Hi, excuse the late reply.

the problem was an error in Ensemble 2016.1 version regarding the resource query in the Ens.DeepSee.ActivityVolumeAndDurationKPI  

// Parameter RESOURCE = "%Ens_Dashboard:USE";

Parameter RESOURCE = "%Ens_Dashboard";

After adding the permissions it worked so far, but I had to add the deep sea resource to the user.

DB_activity rw
%DeepSee_Portal u   
%Ens_Dashboard u


Kind regards


Hi, thank you so much, yes, it works the way you described it. 
I have extended the call with a username/password. This also works as long as I assign %ALL permissions to this user. 
Unfortunately, it does not work with any other role.  

The %Ens_Dashboard: Use is assigned to the user, also the RW authorization for the db's.
I'm sure it's a little something.... 


Not connected with datasource


Kind regards 


Hi Graham,

please try

<assign value='source.{PID:PatientIDInternalID(1).ID}_"^^^STLMC^MR"' property='target.{PID:3(1)}' action='set' />

I think the test function works differently than the right DTL
Please tell me if it has worked.

Otherwise, try this

with the PID:PatientIDInternal(1).ID did you set the PID:3.1 please append  value in the other subfields a second step. Like this:

<assign value='source.{PID:PatientIDInternalID(1).ID}' property='target.{PID:3(1)}' action='set' />

<assign value='"^^^STLMC^MR"' property='target.{PID:3(1)}' action='append' />


<assign value='source.{PID:3(1).1}' property='target.{PID:3(1).1}' action='set' />

<assign value='"STLMC"' property='target.{PID:3(1).4}' action='set' />

<assign value='"MR"' property='target.{PID:3(1).5}' action='set' />

Good evening,

I would save the rtf-file locally and then send as attachment.


See attachfile.

If successful, it can be deleted.

Edit: Sorry forget the extract problem...

 set FileName = source.GetValueAt("TXA:16") or something else +rtf
 set stream = source.GetValueAt("OBXgrp(6).OBX:5.5")
 set file=##class(%FileBinaryStream).%New()
set filePath = "E:\transfer\smtp\rtfs\"
set file.Filename=Filepath_Filename
set tSc = file.Rewind()
set tSC = file.Write(stream)
set tSC = file.Rewind()
set tSC = file.%Save()

Only a idea, no functional guarantee

Best regards

Armin Gayl