Written by

Question Mark OReilly · May 18, 2023

Streamcontainer to operation original filename won't be set

Trying to pass pdf to save to custom file  using default Trying to pass pdf to save to custom file  and %f. but oriignal filename didn't send (it does in terminal). What is missing from setting filename from stream? can the file passthrough not out of box use outputfilename or has wrong default one been sent. 

set fname="ThisHasBeenChanged.pdf"Set test = ##class(File.EpacsPDF).%OpenId(1)
set tempStream=##Class(%Stream.FileCharacter).%New()
Set sendstream = ##Class(Ens.StreamContainer).%New()
 
set sendstream.OriginalFilename=fname
set sendstream.OutputFilename=fname
Set tempStream= test.document
//Set the stream of the StreamContainerset tSC= sendstream.StreamSet(tempStream)
set tsc =..SendRequestAsync(..ForwardComponentName,sendstream,0)

Product version: IRIS 2022.1

Comments

Mark OReilly · May 18, 2023

I think the setstream wipes out the originalFilename field but the other way around results in zero bytes

0
Anthony Filaski  May 26, 2024 to Mark OReilly

Thank you for this comment, Mark. I had a similar problem which was driving me bonkers and turns out the order does matter as you pointed out. Need to do SetStream() first before setting the OutputFilename and OriginalFilename.

0
Mark OReilly · May 18, 2023
set streamContainer=..CreatePythonPDFStream()
 set streamContainer.OriginalFilename="test2.pdf"

issue did not happen whenever finished this with python (more complex) and it coming from a classmethod so unsure what the problem was

0
Padmaja Konduru · May 19, 2023

You can try the below command instead of Set tempStream= test.document

do tempStream.write(test.document) 

0
Enrico Parisi · May 19, 2023

What's the class/type of test.document property?

sendstream.OriginalFilename is replaced/modified by the StreamSet() method

0