TableRow to Variable - inconsistent variable data type

When I have a table with a single row and columns of Double and Integer type, and in this columns I have values like: 1.2, 2.4, 3, 3.1, 5, 5.7 etc. and I want to use them as a variable in a loop, so i take Column List Loop Start, then I Extract Column Header so the only column has always the same name, next I Rename the column to some name like PARAM and change its type to Double, but despite the new column is now always of Double type, the variable type changes between Integer and Double, depending wether there is a decimal separator in number or not. This causes Java Snippets, and Math Expression nodes to fail their execution.


Please see the attached project.

...ok, I'll answer my onwn question - creating an empty table with same named, single data column of type Double and concatenating a resulting row (after Column Rename) to it solves the problem?!?


you should avoid using the column rename node to change the column type, as it doesn't really change the column type properly.

you may want to try using the number to string node, and then followed by the string to number node in which you set it to output as double type.

you could also use the maths formula node instead, using the column in the expression and use one of the expressions where you can round to the desired number of decimal points which should help force the output as double type


Converting from Number to String and back is an extremely slow way. It's a shame that there is no proper type casting node in the KNIME...

A proper typecasting node is something I have requested in the past several times also. I do think it would be beneficial having such functionality available.


1 Like

I have a similar case that probably is also worse. If I extract a number with long type from a database and convert it to a variable, it is converted with a one decimal digit (I don't know if this is a bug or not, I will ask for it). So to rewrite this (originally) long number from flow variable into a column I need a workaround of 4 nodes: Variable to Table Column (writing a double number) → Double to Int (to remove the decimal digit) → Number to String → String to (long) Number.

So, I completely agree with you guys, having a proper typecasting node will help.


1 Like

There are only three flow variables types, string, double, and integer. Since a long is larger than an integer it is converted into a double flow variable. If you know that the value fits into an integer you can already cast it in the SQL statement.

Hello Thor,

Thank you for your quick reply. The value I mentioned was originally a bigint (in the database), so it is a large integer number. KNIME imports it as a long which, if understood well can be both integer and decimal.

The fact that there are only three flow variable types, explains me the behavior I reported.

@gcincilla, I am running into the same issue. I have a Long datatype coming in, and TableRow to Variable Node converts it to a Double. Were you able to find a solution to this problem?

Hi there all,

with KNIME December release (v 4.1.0.) new flow variable types are coming (including long type). Stay tuned!


1 Like

Great news Ivan! Thanks for updating this thread.

1 Like

Saqib, as I mentioned in my earlier message the workaround I used was consisting in the following 4 nodes:

Variable to Table Column (writing a double number) → Double to Int (to remove the decimal digit) → Number to String → String to (long) Number.

I hope this will help you while we wait for KNIME December release (v 4.1.0.) as mentioned by Ivan.