Format output filename by extending input file name


#1

I just started with Knime and I don´t get how I can format the name of the output file. Right now it just uses the input name (where does this information come from?). I want to extend the output with “_calibrated.xml” How to do that?


#2

Hi!

Which node(s) are you using?

Br,
Ivan


#3

I’m using Input File or Input Files and Output File or Output Files


#4

But which nodes are you using for Input and Output? :slight_smile:
Ivan


#5

Hi,

I guess you are using “XML Reader” and “XML Writer” nodes as you mentioned your file name with a .xml extension.
The “XML Writer” node doesn’t have any configuration for the file name, instead it uses the row ID as the name for output file. So if you want to modify the output file name, you have to modify the row ID. To do that, you can use a “String Manipulation” node and create a new column. You can use this expression for example: join($$ROWID$$, "_Calibrated") and then replace the current value of row ID by the value of the created column using “RowID” node.
xml

Best,
Armin


#6

I’m actually using these nodes: “Community Nodes/GenericKnimeNodes/IO/…”
Then I use nodes from OpenMS. They seem to propagate the file name until the end node, which is the “Output File” node.


#7

The “Output File” and “Output Files” nodes in the directory that you mentioned get file names in their configuration. The “Output Files” node add a suffix (counter) to the name. The output file will be in CSV format.

If you think I’m not getting you, then please provide me with a exported workflow or even a snapshot of your workflow so that I can understand your issue correctly.


#8

You can use file name flow variable and java edit variable node for naming output file using input file