Pass a Flow Varriable to CSV Writer

How do I pass a flow variable with a file name to the CSV Writer node?

The simple answer is to just connect a red flow path containing your path variable to the variable input of the CSV writer node:

image

And then in the CSV Writer node configuration, specify that you want the path to be determined by the path variable:

image

Have you already created the path variable? If not, then do so using the Create File/Folder Variables node (assuming you’re using the latest version of KNIME). If you have a complex naming requirement, then you may need to do some manipulation prior to using the Create File/Folder Variables node.

If you can share with us more information about your specific situation, then we may be able to help you further.

2 Likes

I tried your suggestion, but I don’t understand how to set the Create File/Folder Variables node.
I’ve assembled the file name I want to pass as a flow variabel:

Which produces this:

Then:

Pass Flow Variable:
3

Configure CSV Writer:

Hi @rfeigel , from what I can see from your metanode, it looks like you are building the file path with these String Manipulation nodes. These nodes will output a data table (black triangle), and linking your String Manipulation node to your Create File/Folder Variables node via the variable port (red circle) is not going to use any of the values that the String Manipulation nodes have created.

The way to use what the String Manipulation nodes have created is to convert the data into variable, like the Table Row to Variable node you are using, though I am not sure why you are using a deprecated version of it. There are updated versions of this node.

So, if you want to use the values from the String Manipulation as variable, you should connect the Table Row to Variable to the Create File/Folder Variables node.

In your case, it might be more relevant to use the String to Path (Variable) node instead of the Create File/Folder Variables node if you are building the path through these String Manipulation

2 Likes

Your last suggestion worked. Thanks very much!

Revised 1

2 Likes

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.