# Flow variable for data type in Column Rename node

**URL:** <https://forum.knime.com/t/flow-variable-for-data-type-in-column-rename-node/43259>\
**Category:** KNIME Analytics Platform\
**Created:** [May 21, 2022, 2:19am UTC](https://forum.knime.com/t/flow-variable-for-data-type-in-column-rename-node/43259 "2022-05-21T02:19:38Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![rfeigel](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/r/7ea924/32.png) [@rfeigel](https://forum.knime.com/u/rfeigel)\
**Post date:** [May 21, 2022, 2:19am UTC](https://forum.knime.com/t/flow-variable-for-data-type-in-column-rename-node/43259/1 "2022-05-21T02:19:38Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![elsamuel](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/e/b4bc9f/32.png) [@elsamuel](https://forum.knime.com/u/elsamuel)\
**Post date:** [May 21, 2022, 4:37am UTC](https://forum.knime.com/t/flow-variable-for-data-type-in-column-rename-node/43259/2 "2022-05-21T04:37:06Z")

</div>

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](https://forum-cdn.knime.com/uploads/default/original/3X/3/e/3ec6c9f333d7b2807ce26bcd01bf1d465fe7906c.png)

Run the node, and see what value the Flow Variable takes.  
 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/6/d/6d7e140e7db77b1b33537d12d8423a8bcac5b9bc.png)

Create that flow variable and use to control the configuration of the node:  
 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/6/c/6cfa0f8e86a65d7dde71b3d92ea86b86376e23b2.png)

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

---

<div class="post-metadata">

**Author:** ![iCFO](https://forum-cdn.knime.com/user_avatar/forum.knime.com/icfo/32/36036_2.png) [@iCFO](https://forum.knime.com/u/iCFO)\
**Post date:** [May 21, 2022, 1:25pm UTC](https://forum.knime.com/t/flow-variable-for-data-type-in-column-rename-node/43259/3 "2022-05-21T13:25:15Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![rfeigel](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/r/7ea924/32.png) [@rfeigel](https://forum.knime.com/u/rfeigel)\
**Post date:** [May 21, 2022, 8:17pm UTC](https://forum.knime.com/t/flow-variable-for-data-type-in-column-rename-node/43259/4 "2022-05-21T20:17:51Z")

</div>

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.

 ![String Manipulation](https://forum-cdn.knime.com/uploads/default/original/3X/b/d/bd7efdc77585470092a706a60f152990cc260dc4.jpeg)

---

<div class="post-metadata">

**Author:** ![elsamuel](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/e/b4bc9f/32.png) [@elsamuel](https://forum.knime.com/u/elsamuel)\
**Post date:** [May 21, 2022, 8:35pm UTC](https://forum.knime.com/t/flow-variable-for-data-type-in-column-rename-node/43259/5 "2022-05-21T20:35:08Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![rfeigel](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/r/7ea924/32.png) [@rfeigel](https://forum.knime.com/u/rfeigel)\
**Post date:** [May 21, 2022, 9:04pm UTC](https://forum.knime.com/t/flow-variable-for-data-type-in-column-rename-node/43259/6 "2022-05-21T21:04:39Z")

</div>

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.

> **[Richard Feigel sent you 1 item](https://www.dropbox.com/t/gYmvsqb43fryyk7J)**
>
> REF Challenge 17 rev 1.knwf

---

<div class="post-metadata">

**Author:** ![elsamuel](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/e/b4bc9f/32.png) [@elsamuel](https://forum.knime.com/u/elsamuel)\
**Post date:** [May 22, 2022, 3:35am UTC](https://forum.knime.com/t/flow-variable-for-data-type-in-column-rename-node/43259/7 "2022-05-22T03:35:49Z")

</div>

Use the Column Auto Type Cast node first.

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

---

<div class="post-metadata">

**Author:** ![rfeigel](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/r/7ea924/32.png) [@rfeigel](https://forum.knime.com/u/rfeigel)\
**Post date:** [May 22, 2022, 4:09am UTC](https://forum.knime.com/t/flow-variable-for-data-type-in-column-rename-node/43259/8 "2022-05-22T04:09:49Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![badger101](https://forum-cdn.knime.com/user_avatar/forum.knime.com/badger101/32/45755_2.png) [@badger101](https://forum.knime.com/u/badger101)\
**Post date:** [May 22, 2022, 5:05am UTC](https://forum.knime.com/t/flow-variable-for-data-type-in-column-rename-node/43259/9 "2022-05-22T05:05:32Z")

</div>

👍 👍 👍 👍 👍 👍 👍 Awesome!

---

<div class="post-metadata">

**Author:** ![mlauber71](https://forum-cdn.knime.com/user_avatar/forum.knime.com/mlauber71/32/73590_2.png) [@mlauber71](https://forum.knime.com/u/mlauber71)\
**Post date:** [May 22, 2022, 6:09pm UTC](https://forum.knime.com/t/flow-variable-for-data-type-in-column-rename-node/43259/10 "2022-05-22T18:09:17Z")

</div>

> [@rfeigel](#):
>
> Column Rename node

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

> [@KNIME nodes corrupting on multiple computers](https://forum.knime.com/t/knime-nodes-corrupting-on-multiple-computers/13277/7):
>
> OK I have a theory of what is going on with the rename node and the changed column types. It seems the rename node stores the information of which type it should assign to a column based on the originating type of the column in question. An integer would have other possibilities to be turned into than a Double. The corresponding numbers are now stored in an XML file “settings.xml” If I would now rename the integer into double and the Double into Fuzzy like this T…

---

<div class="post-metadata">

**Author:** ![system](https://forum-cdn.knime.com/uploads/default/original/1X/ab3ccf34482a0329361734a18199390177204f15.png) [@system](https://forum.knime.com/u/system)\
**Post date:** [May 29, 2022, 6:10pm UTC](https://forum.knime.com/t/flow-variable-for-data-type-in-column-rename-node/43259/11 "2022-05-29T18:10:15Z")

</div>

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