Written by

Frustrated Integration Developer
Question Jani Hurskainen · Apr 2, 2024

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.437
Product version: IRIS 2022.1
$ZV: IRIS for UNIX (Ubuntu Server LTS for x86-64 Containers) 2022.1.2 (Build 574_0_22161U) Tue Jan 24 2023 11:05:57 EST

Comments

David Hockenbroch · Apr 2, 2024

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)

0
Jani Hurskainen  Apr 3, 2024 to David Hockenbroch

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.

0
Enrico Parisi  Apr 3, 2024 to Jani Hurskainen

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?

0
Jani Hurskainen  Apr 8, 2024 to Enrico Parisi

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"
0
Jani Hurskainen  Apr 8, 2024 to Jani Hurskainen

AFAICS the documentation says nothing about the relationship between OriginalFilename property and %f specifier.

0