I’m using cell splitter with a “.” delimiter to split some barcode data. The splitter is automatically converting text values to integers. Eg., 565.001 is being split into 565 and 1, instead of 565 and 001. This happens even if I designate the source column as string.
Please see the attached workflow to reproduce the issue. I’m using the latest version of Knime: 4.6.1
test_splitter.knwf (8.6 KB)
@kasi and welcome to the Knime Community.
Indeed, Knime will try to guess the type of the columns after the split, and if it sees only numbers, it will assume that it’s and integer column.
Of course, that would mean your 001 will become 1 unfortunately.
You can try the hack that I suggested in this recent thread:
@jarviscampbell , I’m not sure you understood what I was trying to do if you said that you hoped I meant bring back to string “before” the split. Before the split, the values in your column target are already strings. It’s only after the split that they do not seem to be anymore.
In any case, I got curious to see what my manipulation gave, and it looks like the split itself gives you the values in Double:
You can see the [D] in the column names that indicates a type Double. The fi…
By adding the dummy character “#” (or any non-numerical character), it will keep the column as String
EDIT: Here’s how it’s applied to your case in case you can’t figure it out:
Here’s the output:
Here’s the workflow:
test_splitter_Bruno.knwf (12.3 KB)
Thank you for this suggestion. I was able to split them using your suggested method. Still, it feels weird that Knime would allow for data loss without an option to configure it.
@kasi , I agree, it is weird, especially that the data is “lost”.
I understand that Knime wants to guess the type, but I think it might safer to put the output as String, as it’s usually no issue converting string to other types, but not the other way around.
@bruno29a already provided the solution (that’s great)
I tried splitting into list and then into columns and that seems to work
@Daniel_Weikert This looks more efficient. Thank you.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.