Invalid Oref when trying to extract Base64 Encoded PDF from HL7 Field
Hi all,
I'm using a snippet I found from Scott Roth to extract, decode, and save a PDF from a HL7 message and save it to a specified file path, but I'm running issues with the following error:
My approach was to a create a utility function accessible from a DTL like this:
Class ELHTPRODPKG.Functions.Utility.ExtractPDF Extends Ens.Rule.FunctionSet
{
ClassMethod DecodeBase64HL7(base64 As %Stream.GlobalBinary, Path As %String, FileName As %String) As %String [ Final ]
{
//Debug
WRITE $LENGTH(base64)
// Decode
set Oref = ##class(%FileBinaryStream).%New()
set Oref.Filename = Path_FileName
Do base64.Rewind()
While 'base64.AtEnd
{
set ln=base64.ReadLine()
set lnDecoded=$system.Encryption.Base64Decode(ln)
do Oref.Write(lnDecoded)
}
Do Oref.%Save()
return Oref.Filename
}
}
But I think something must be wrong with my code, I am invoking the custom utility function in the DTL with a code action like this:
I am very new to writing ObjectScript so I apologise if this is a very basic error, I've spent ages trying to resolve the issue myself but I'm stumped,
Please could someone point me in the right direction and explain why what I've done doesn't work and what I would need to do to fix it,
Thanks in advance,
Ben