Add variables to specific cells in .csv output

I have a requirement to take an output from a SQL script and place that into a .csv. But the problem I’m having is that I need to place the run date in cell b1 (YYYYMMDD) and a fixed number in cell a1 (1).

Is there a way to control that kind of detail at a cell level in Knime?

MicrosoftTeams-image (1)

Welcome to the forum @MikeRose.

What is the output of the Append Report Run Time metanode? My suggestion would be to follow this metanode with a Variable to Table Row node, and then a Concatenate node to combine this row with the table from the DB Query Reader.

You may need to alter the column names in the Variable to Table Row output table to get the concatenate to work properly.

1 Like

Thanks, elsamuel!

The purpose of that metanode is to append the run date to the filename in a variable that is applied when the .csv is written.
This is probably a dumb question, but based on your workflow, how would I fit that into the workflow I have above? Specifically getting the output from SQL into the created table.

You’ve said

I need to place the run date in cell b1 (YYYYMMDD) and a fixed number in cell a1 (1).

I assumed that the Append Report Run Time metanode was creating these pieces of data, but I wanted to confirm. This is why I asked you what the output of the metanode was.

The purpose of that metanode is to append the run date to the filename in a variable that is applied when the .csv is written.

This doesn’t really answer the question I asked (and in fact it brings up another set of questions).
So, again, what is the output of the Append Report Run Time metanode? Does it contain the variables that house the run date that you’d like to place in cell b1 and the fixed number that you’d like to place in cell a1?

based on your workflow, how would I fit that into the workflow I have above? Specifically getting the output from SQL into the created table.

Assuming that the output of your Append Report Run Time metanode is a list of the variables that contain the information you want to append to the header of your CSV file, then

  • your Append Report Run Time metanode is analogous to my Variable Creator node,
  • your DB Query Reader node is analogous to my Table Creator node.
1 Like

Apologies for the lack of clarity. The append report run outputs these variables that do contain the run date:

Which creates this file name:
image

It does not contain the variable that I was to see in a1 (but I suppose that wouldn’t be an issue to add it there).

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