String to Number function in Excel

Hi,

Good day to all, I new to Knime and trying to replicate this function from excel. Can you guide me how to do it? I am thinking of using row filter or string manipulation node to convert the non numeric, your suggestion is greatly appreciated.
VC_con
SKU_con

Hey there and welcome to the forum!

Can you elaborate a little more on the context?

From what I can see in your first screenshot you have a mix of values that contain numbers only and others that contain numbers as well as other characters. In Knime, when you use e.g. Excel Reader, this column will be likely treated as a string-type column (as it will not be able to convert e.g. 7WA848 into a number)

With the second screenshot it looks like there’s just numbers in it - when reading that into KNIME with Excel Reader it should detect this as a integer or double-type column (unless there are non-numerical characters hidden further down in that column).

If for some reason it is not detected as numerical column you can force that in the Transformations tab of Excel Reader.

With regards to writing into Excel: If a numerical-type column (integer/double/long) is written into Excel you won’t see that message. Only if for some reason it is treated a string type column. You could use a String To Number converter node to convert before writing.

I know this may be a lot to take in - if you can share more details on what exactly it is you are trying to achieve, we can certainly provide some more detailed guidance as well.

Hi @dantesalem,

To convert from string to number use String To Number Node

And to convert number to sting use String to Number Node

Regards,
Yogesh

2 Likes

The images below show results generated using the Excel writer. The final node in the workflow is the Row Filter, to which I connected the Excel writer to view the output. The next step after the Row Filter is to scan the entries in the SKU column, as shown in the first image with the value 817777, and similarly in the reseller code column, as shown in the second image with the value 2882. The goal is to scan the entire column, convert numeric entries read as strings into numbers. BTW both columns have a combination of numeric and alphanumeric entries, for some reason there are numeric entries being read as strings.
image

I see.

So as far as I know KNIME defines data types on a “column” basis - e.g. if you have a column that only contains numbers this column can be either of type integer, double, long or even string (although you’d need to convert that)

KNIME does not have “mixed-type” columns - i.e. where it defines the data type based on a single cell.

And if you say that you have in all columns also other characters than numbers than the behavior that this gets written as string-type column is expected.

So your goal is to write columns that have numbers as well as other characters into Excel and to show the “number only” cells as numbers rather than strings?

I’m afraid I am not sure that is possible…

4 Likes

Thanks for clarifying; I will just explain it to the requestor that the process is really not possible.