How to define file name in EnsLib.File.PassthroughOperation?
EnsLib.File.PassthroughOperation has File Name property with default value: %f_%Q%!+(_a)
The Management Portal documentation description of the property:
Name of file to output the document(s) to. May include timestamp specifiers. The %f specifier if present will be replaced with the name of the document's original source filename (stripped of characters illegal in target filenames).
See the method Ens.Util.File.CreateTimestamp() for documentation of timestamping options.
More documentation describing the behaviour of %f: https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cl…
But I fail to find any documentation how I can set the "document's original source filename". The data is written correctly to a file but the file names are like:
$ ls -1 /tmp/out/
_2024-04-02_17.10.16.766
_2024-04-02_17.12.14.145
_2024-04-02_17.24.06.437Comments
The document's original source file name is the name the file had when it was received. %f is a shorthand for using that in the file name. If you wanted them all to be named "myfile" with the timestamp on the end, you'd change the Filename property to myfile_%Q%!+(_a)
Yes that works, but I don't think the documentation agrees. https://docs.intersystems.com/irislatest/csp/documatic/%25CSP.Documatic… says:
The %f specifier if present will be replaced with the name of the document's original source filename (stripped of certain characters in target filenames - see CharacterSetToRemove)
If I can't set "the name of the document's original source filename" then IMO the documentation is wrong.
If %f is not working in your environment my guess is that, for some reason, the property OriginalFilename is not set in the incoming message to your EnsLib.File.PassthroughOperation Business Operation.
Where is the incoming message coming from? Why the OriginalFilename is not set?
Can you provide some more details on your environment?
Argh. Ens.StreamContainer#StreamSet silently overwrites OriginalFilename property.
Filename (%f) is empty:
// in is a character stream
#dim exportRequest = ##class(Ens.StreamContainer).%New()
set exportRequest.OriginalFilename = "foo"
set status = exportRequest.StreamSet(in)
Filename (%f) is "foo":
// in is a character stream
#dim exportRequest = ##class(Ens.StreamContainer).%New()
set status = exportRequest.StreamSet(in)
set exportRequest.OriginalFilename = "foo"AFAICS the documentation says nothing about the relationship between OriginalFilename property and %f specifier.