Cell Splitter is converting strings to integer automatically

Hello,

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)

Hi @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:

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:
image

Here’s the output:
image

Here’s the workflow: test_splitter_Bruno.knwf (12.3 KB)

3 Likes

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.

Hi @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.

1 Like

@bruno29a already provided the solution (that’s great)
I tried splitting into list and then into columns and that seems to work
save

br

2 Likes

@Daniel_Weikert This looks more efficient. Thank you.

1 Like

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