Column name generated on the fly


Is there a way to create a new column with its column name generated on the fly in a Java snippet ? Basically, I am generating a column name based on values from the incoming data stream, and each time this name will be different.

Thank you


Just use a flow variable as the output column name (outCols/_index of output (probably 0)_/Name) and it will replace the one you previously specified.

Cheers, gabor

Hi gabor,

Thank you for your answer. I'm new to Knime and I don't get exactly what you mean, sorry.

Maybe as information: I'm generating more than one new column at a time (but don't know a priori how many). And then a new calculated value (extracted from the input stream) is assigned to each of these column.

Hope you can help.



In case you do need variable number of new columns, you will need one of the scripting (R, Jython, ...) nodes, I think the Java Snippet is not suitable for this. The option I described only works for fix number of new columns.

Instead of producing an unknown number of single-value columns, you could make a single collection column, i.e have your java snippet produce an array. You could then then split the collection column using the appropriate node, which will give you a number of columns equal to the longest array.