KNIME External tool - column type detection

The “External tool” is trying to be overly smart and creating output columns as integer when I want strings. I have identifiers in the output like “000392993” and need to treat them as a string and preserve the leading zeroes. Unfortunately the tool says “aha this is a number” and converts it to an integer. Is there a way to specify the column type, or at least stop the conversion to another type in the table output?

Hi,

This also happens when you read a CSV file in other applications. For example in excel the number should be inside double quotes and after a equal sign (e.g. =“001”) so that it would be read as 001.
So this is a bit tricky to read a number as string but here I have a few suggestions:

  1. Check the output file by your external tool (the other application not the node) and see if the numbers which you have saved as string are quoted or not. If yes, then I suggest using External Tool (Labs) and changing the quote character for the output file to something else. Then your numbers will be read in complete format but quotes are also there. You can use String Manipulation to remove those quotes.

  2. If the numbers are not quoted, I guess you only have 2 options left: Put a string character with the numbers in your external tool (the other application) and then remove it in KNIME, or put the zeros by yourself using the String Manipulation node.

Best,
Armin

1 Like

You could try and user Readr with R to force an import as a string. Maybe not the most elegant way but it should work.

2 Likes

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