Write text with variables to a file

I use KNIME to process data and create a CSV file that is used in a downstream application.

For the downstream application I need some metadata from the workflow. Is there a way/node to create a longer text file using flow variables?

The idea behind this is to create commented queries for the downstream application and export them to a file next to the CSV data.

@mpreusse you could extract several meta information from the workflow, the files you use or the current table/data in knime.

(And there are more)

You can then store that into a table, if you have a variable you can convert that to data. The data you can then store in any format you like.

In this example you can see how to extract meta information from a file:

5 Likes

Thanks @mlauber71 for the pointers!

I begin to understand how I can handle metadata. I also found the Table Creator node that I can use to store comments and the queries I mentioned.

There is one thing I did not find yet:
Is there a way to create a variable or table and store a string with a flow variable? Something like:

Some text here that uses $some_variable_from_flow
1 Like

@mpreusse glad you liked the links

If you just want to create texts you could use a Java Snippet (simple) either to create a Flow variable or a column, which then you could convert into a column in a table or a Flow variable.

Simple Java snippets have these

return <your content>;

Syntax where the content can also contain results from a Flow variable. With a little planning and experimenting you have nearly endless possibilities to combine information.

Another powerful tool is the

Of you could just use the Rule engine, which also is quite handy:

3 Likes

Thanks @mlauber71, I did not know about the simple Java Snippet before, that is really flexible.

3 Likes

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