Flow variable for data type in Column Rename node

How can I pass a flow variable to the Column Rename node to change the data type from datavalue to stringvalue? I’m trying to avoid having manually change it for hundreds of columns.

The simple way to figure out flow variable is to first configure the node the way you want it.Then go to the Flow Variables tab and define the name for a flow variable for the field you want:
image

Run the node, and see what value the Flow Variable takes.
image

Create that flow variable and use to control the configuration of the node:
image

If you have hundreds of columns, then I’d probably consider using a string($$CURRENTCOLUMN$$) function in the String Manipulation (Multi-Column) node.

4 Likes

I like to use the Column Expressions node to perform a logic test and flag the columns, then column splitter node to separate them, then a Multi-Column node to apply the changes to all routed columns as described above.

Thanks for the prompt reply. I tried the String Manipulation node, but can get it to convert the column headers to strings like the manual Column Rename node will. What am I missing? Executing the node with the attached configuration does nothing.

The screenshot is cut off; how is the rest of node configured?

It would be easiest if you uploaded some data and maybe a workflow so that we can take a look.

Here’s the workflow with the Column Rename node and a String Manipulation stub. Its my attempt at Just KnimeIt Challenge 17. Its too large to send. Here’s a DropBox link. Thanks for having a look.

Use the Column Auto Type Cast node first.

If after that you still want strings, then the String Manipulation (Multi Column) node will work…

2 Likes

Thanks very much! All I needed was the Column Auto Type Cast node. The only reason I was using the String Manipulation node was to feed a manual Column Rename node. Folks like you are great. I’m a 76 year old retiree and relative Knime neophyte. I’m playing with Knime to keep a few brain cells firing.

6 Likes

:+1: :+1: :+1: :+1: :+1: :+1: :+1: Awesome!

Though the rename node does allow the change of variable types it can lead to unwanted results

1 Like

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