I took your suggestion about using %Net.FtpSession to transfer the file back and forth between the two boxes, however I am running into an issue trying to ftp.Store the file. Can I have a second pair of eyes take a look at this to see what I am doing wrong?

 

ClassMethod DecodeBase64HL7ToFileFaxing(base64 As %Stream.GlobalBinary, Ancillary As %String, FileName As %String) As %String
{
set ftp=##class(%Net.FtpSession).%New()
if 'ftp.Connect("xxxxx","xxxxx","xxxxxx") $$$LOGINFO("Unable to connect to inteng11") quit



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

Do base64.Rewind()

While 'base64.AtEnd {
     set ln = base64.ReadLine()
    set lnDecoded = $system.Encryption.Base64Decode(ln)
do Oref.Write(lnDecoded)
}
if 'ftp.SetDirectory("/home/egate/Scott") $$$LOGINFO("Unable to change directory") quit
If 'ftp.Store(Oref,stream) $$$LOGINFO("Unable to write file") quit
if 'ftp.Logout() $$$LOGINFO("Failed to logout") quit

}

 

Thanks

Here is how I am Calling the Method and Returning me the string

<transform sourceClass='EnsLib.HL7.Message' targetClass='osuwmc.Visit.DataStructures.InsertVisitAttachmentResult' sourceDocType='ORMORUPDF:OSU_ORMORU_PDF' create='new' language='objectscript' >
<assign value='context.TextIDTemp' property='target.TextID' action='set' />
<assign value='source.GetFieldStreamRaw(.tStream,"ORCgrp(1).OBRgrp(1).OBXgrp(1).OBX:ObservationValue(1).AlternateText",.tRemainder)' property='tSC' action='set' />
<assign value='##class(osuwmc.Functions).DecodeBase64HL7ToFile(tStream,source.{MSH:SendingApplication.NamespaceID},source.{PID:PatientIdentifierList(1).IDNumber}_context.TextIDTemp_".pdf")' property='tSC' action='set' />
<assign value='$Get(tSC)' property='target.Text' action='set' />
</transform>

I just worked with WRC on this same issue. I was able to make copies of %ZEN.Dialog.finderDialog and EnsPortal.LookupSettings. By using these copies I was able to modify some of the methods to limit down the number of tables a end user would have access too by using a filter on the Naming convention.


Class osuwmc.DataLookup.testFinderDialog Extends %ZEN.Dialog.finderDialog
{

Method GetFinderArray(ByRef pParameters, Output pMetaData, Output pData) As %Status
{

Kill tParms

// assemble search parameters
Set tParms("sort") = ..currSortMode
Set tParms("search") = ..searchKey
Set tParms("abstract") = ..includeAbstract

if (..mode = "labLookup"){

tSC = ##class(%ZEN.FinderUtils).%GetArrayForQuery("Ens.Util.LookupTable","Enumerate",$LB("{Name}","{Name}_"".lut""","lut",""),".",,.pMetaData,.tData)
k=""
for {
k=$order(tData(k))
q:k=""
tableName = $li(tData(k),1)
if (tableName [ "LABS") {
pData($i(pData)) = tData(k)
}

}
tSC
}
else {
Quit ##class(%ZEN.FinderUtils).%GetClassListArray(.tParms,.pMetaData,.pData)
}
}


Class osuwmc.DataLookup.testLookupSettings Extends EnsPortal.LookupSettings
{

/// Handle various dialogs.
ClientMethod onPopupAction(popupName, action, value) [ Language = javascript ]
{
try {
if (action != "ok") {
return false;
}
popupName this.removePopupSuffix(popupName);
switch(popupName) {
case 'NewLookup':
if (value.substring(value.length-4).toUpperCase() != '.LUT') value += '.lut';
// note that we fall through to open the page for both NewLookup and LookupOpen
case 'LookupOpen':
var link zenLink('osuwmc.DataLookup.testLookupSettings.zen');
link += (link.indexOf('?') -1 '&' '?') 'LookupTable=' encodeURIComponent(value);
this.setModified(false);
this.gotoPage(link);
break;
case 'switchNamespace':
zenPage.changeURLNamespace(value);
break;
case 'LookupSaveAs':
if (value.substring(value.length-4).toUpperCase() == '.LUT') value value.substring(0,value.length-4);
zenPage.checkName(value);
break;
}
}
catch (ex) {
alert("Error: " ex);
}
}

/// If the new name is already in use, confirm that the user wishes to overwrite the old table of that name.
ClientMethod checkName(newName) [ Language = javascript ]
{

var duplicateName zenPage.NameCheck(newName);
if (duplicateName !="")
{
if (!confirm($$$FormatText($$$Text("Lookup table name '%1' is already in use! Are you sure you want to overwrite this table?"),duplicateName))) {
return;
}
zenPage.RemoveTable(duplicateName);
}
zenPage.renameSave(newName);
var link zenLink('osuwmc.DataLookup.testLookupSettings.zen');
link += (link.indexOf('?') -1 '&' '?') 'LookupTable=' encodeURIComponent(newName+".lut");
this.setModified(false);
this.gotoPage(link);
}

ClientMethod openTable() [ Language = javascript ]
{
if (this.pageModified) {
var doOpen confirm($$$Text('The current lookup table has been modified. Do you wish to discard these changes and open a different lookup table?'));
if (!doOpen) return;
}
var parms { MODE: "labLookup"};
zenLaunchPopupWindow(zenLink('osuwmc.DataLookup.testFinderDialog.cls'),this.addPopupSuffix('LookupOpen'),'status,scrollbars,resizable=yes,width=800,height=600',parms);
}

Method OnGetRibbonInfo(Output pDisplay As %Boolean, Output pViewIcons As %List, Output pSortOptions As %List, Output pSearchBox As %Boolean, Output pRibbonTitle As %String, Output pCommands As %List) As %Status
{
Set pDisplay = 1
Set pRibbonTitle = $$$Text("Lookup Table Viewer")
Set pCommands(1) = $LB("btnOpen",$$$Text("Open"),$$$Text("Open an existing lookup table"),"zenPage.openTable();")
Set pCommands(2) = $LB("btnSave",$$$Text("Save"),$$$Text("Save the current lookup table"),"zenPage.saveTable();")
Set pCommands(3) = $LB("btnSaveAs",$$$Text("Save As"),$$$Text("Save the current lookup table with a different name"),"zenPage.saveTableAs();")
Quit $$$OK
}

}