File name flow variables question - CSV Writer

Hi everyone,

A quick question regarding setting file name flow variables in CSV Writer. Previously, using CSV Writer deprecated node, I was able to set the filename variable by accessing the Flow Variables tab. However, with the (new) CSV writer node, I can’t seem to find the means to set the filename flow variable under the similar Flow Variables tab. I am aware that there is a V button next to the browse button under the Output location, but when I click it, I am unable to set the flow variable - it doesn’t seem to detect any flow variable. It works fine when I use the deprecated CSV writer, but I would like to use the non-deprecated version where possible.

Currently on KNIME 4.3.0.

Thanks for the advice!

Regards,
Andy

1 Like

Hi Andy,

welcome to the KNIME forum!

With KNIME Analytics Platform 4.3.0 we published our new file handling framework, which includes a new flow variable type for paths.

I assume that your flow variable is at the moment of type string. With the String to Path (Variable) node you can convert your flow variable and use it in the new CSV Writer node to control the output location.

Here is a little example for this:

In this blog post you can find more information about the file handling

Best
Kathrin

3 Likes

Hi Kathrin,

Many thanks for your reply and your illustrated examples. I have some follow-up question - previously, in the old CSV writer I could specify the local folder location for the output and just use the filename as the variable. E.g. Output location: Desktop\Folder and filename variable: Filename (as a string) and thus the outputs are (after running a loop) File1.csv, File2.csv etc.

I tried the String to Path (variable) as you suggested, and the new CSV writer, while it accepts the filename variable (which is a string containing the intedend filename), it is unable to write to the desired local output folder location. I suspect that I have to define the full filepath before the CSV writer node - am I right, and either way what would be the best solution to it?

Kind regards,
Andy

Hi Andy,

here is an example of how I would control the output location and file name in a loop:

Best
Kathrin

2 Likes

Hi Kathrin,

Apologies for the late reply. Many thanks for showing an example workflow, it helps to clarify things!

Regards,
Andrew

1 Like

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