Use flow variables in CSV comment header

I use the comment header a lot when writing CSV files with the CSV Writer node.

Is it possible to use flow variables in the comment header?

In the Flow Variables tab in the CSV Writer node you can specify which flow variables you’d like to use for which comment header fields.


Thanks @elsamuel!

When I select a flow variable it is not written into the comment header. Do I have to select other flow variables? I.e. TRUE for the variable add_custom_test_to_comment?

Here is a simple example workflow to test it:

custom comment header.knar.knwf (9.5 KB)

Hi @mpreusse , here’s a general tip: Don’t forget that the Flow Variables tab in any node is simply allowing you to dynamically control existing settings. In other words, whatever flow variable you are adding is for settings that are configurable in the different tabs of the node.

So for:

You can just go and check how the setting work.

If we look at the CSV Writer node, and in the Comment Header tab, you can see that you cannot use any text, unless you check the box:

It’s not always obvious which Flow Variable point to which settings, but you can try to guess it. Here, we can assume that the “custom_comment_text” refers to that text box, and the “add_custom_text_to_comment” refers to that checkbox.

So, it would appear that you have to set the checkbox to true in order to be able to use that text.

You have 2 options. Either you can check the box in the Coment Header tab, which means it’s statically set to true all the time, and you only dynamically assign a text via your variable as you are currently doing (you can mix static and dynamic together, it does not matter), or you can dynamically set that checkbox to true only when you need it, which is where you will need another variable to control that.


@bruno29a , great reminder and well explained.


Thanks for the explaination @bruno29a!

It works when I check the box and put something in the text field. The content of the text field is overwritten with the content of the flow variable.


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