I’ve been working with KNIME for the last few months to generate CSV exports of data. In general, to ensure a float value always has 2 decimal places, I use the number rounder and then convert to a string to apply padding required by my employer.
I went away for a week and then today I started with a new export, employing the same process of number rounder to get to 2 decimal places and noticed that the number rounder wasn’t ensuring that the float (number(double)) has 2 decimal places anymore.
I decided to try the number formatter node which successfully ensures 2 decimal places but then when it reaches the CSV writer node it removes the unnecessary decimal places, e.g. 8.40 becomes 8.4, 12.00 becomes 12.
This process of mine has worked consistently for the last few months and now all of a sudden it doesn’t. Has anything changed within KNIME that would result in this?
Before reaching my nodes I have confirmed the value is Number (Double). I also confirmed it was Number (Double) before reaching the CSV Writer when I was testing the Number Formatter.
Hi @William_Alexand , I do not know of a reason why this should suddenly sotp working, but the initial description you gave of using the Number Rounder (formerly the Round Double node in older KNIME versions) would appear to be the way to achieve this.
To my knowledge, the Number Formatter changes the way a number is displayed within KNIME, in table views etc, but the chosen formatting is not observed by the CSV Writer. It would be great if it were!
So, assuming you should use the Number Rounder, please check that you are telling it to output rounding to 2 digits, and importantly outputting the value as a Standard String, in the (hidden away for a reason I don’t understand) “Advanced ‘legacy’ Settings” ?
If you have that writing to CSV Writer, it really should output 2 decimal places. If it isn’t, please can you upload a small demo workflow that exhibits the problem you are encountering.
I didn’t check the hidden settings and the solution you suggested works. It now outputs the 2 decimal places in the CSV regardless of their value. Thanks!