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 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' />

OR

<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.

http://docs.intersystems.com/ens20081/csp/docbook/DocBook.UI.Page.cls?KE...

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