15 + years Solutions-oriented Integration Interface Specialist with notable success directing a broad range of corporate IT initiatives while participating in planning and implementation of Integrated solutions in direct support of business objectives. Specialties: Design/Development of MS and Oracle SQL Databases, HL7 Ancillary Solutions, and Intersystem Ensemble Solutions. Integrating it all together to create a more robust environment.
While working with Intersystems Ensemble and now IRIS, I have greatly expanded my knowledge of Ensemble and Cache Object Script by asking questions and watching the Developer Community. I tend to ask questions, then figure out the answers on my own or with a little help from others.
Before Intersystems Ensemble, I spent many years as an eGate developer. Specializing in DART, JDBC, and other out of the normal odds and ends.
Within our DTC...
<assign value='source.GetFieldStreamRaw(.tStream,"ORCgrp(1).OBRgrp(1).OBXgrp(1).OBX:ObservationValue(1).AlternateText",.tRemainder)' property='tSC' action='set' />
<assign value='##class(osuwmc.Utils.Functions).DecodeBase64HL7ToFileFaxing(tStream,source.{MSH:SendingApplication.NamespaceID},source.{PID:PatientIdentifierList(1).IDNumber}_context.TextIDTemp_".PDF")' property='a' action='set' />
With some help from the Developer community, below is a Function I wrote for our needs to take a Base64 and write it out to a PDF.
ClassMethod DecodeBase64HL7ToFileFaxing(base64 As %Stream.GlobalBinary, Ancillary As %String, FileName As %String) As %String
{
set ArchDir = <directory>
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(%Stream.FileBinary).%New()
$$$LOGINFO(FaxDateDir_FileName)
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()
do ##class(%File).SetAttributes(Oref,33261,.return)
set Oref = "" // Close file
set PDFFilePath = "/Fax/PDFFiles/"_Ancillary_"/"_$PIECE($ZDATE($HOROLOG,7)," ",1)_"-"_$PIECE($ZDATE($HOROLOG,7)," ",2)_"-1/"_FileName
return PDFFilePath
}










Nice comparison, also you have to take in account the processing speed as well. I found using Embedded SQL through a SQL Outbound Adapter can slow processing significantly down as it has to build the SQL in the connection to get results. I have a high-volume Business Process that required us to build a Stored Procedure on MS SQL instead of the Embedded SQL so that the SQL Server has the query already built.