replacing "," by linefeed

I would like to explode a string by a character so that get separate lines instead of a concatenated string. It seems to be easy, I use the string manipulation node as it can be seen in the attached wf.

The problem I had to face, that knime simply misses some substring, for example the string has four ,-s, but the function returns two lines only. I don’t use the latest version of knime, maybe is it bug, I cannot reproduce it in a different version.

Could you pls suggest an alternative for this replacement ?

replace.knwf (9.5 KB)

@HarryKl I tested it in KNIME 4.7 and 5.7 and it seems to work. Maybe you can save the example in and executed state or tell us which version of KNIME you use.

Also, you realize that you entered a comma and a blank as separator in the GroupBy node?

2 Likes

Hi @HarryKl ,

I have two (don’t ask haha) KNIME versions installed - 5.2.3 and 5.4.3.

I’ve imported your workflow in both versions and get the same result - the string returns 4 lines (see below screenshot).

Apologies that this isn’t a solution but I thought you might like to know that your method is working correctly (maybe you could upgrade your version?).

thanks.

tp

3 Likes

Hi @HarryKl , I can see from inspecting your uploaded .knwf file that you are using KNIME 4.7.1 which I don’t have installed so difficult to know if it’s a bug in that version. Certainly I have tried it in KNIME 5.5.1 and it works, and also on KNIME 4.7.8.

Reiterating too @mlauber71 ‘s point about the additional space after the comma in the GroupBy. Basically you are doing extra work downstream that you don’t need to do if the GroupBy were modified.

But… unless you are specifically wanting to use String Manipulation for doing this, if your only requirement is that you concatenate the groupings with linefeed, you can just do this directly in the GroupBy node.

Use “\n” as the value delimiter, instead of the “, ”

[edit: I wanted to take a look to see what happened in 4.7.1 but it’s not available on the download site. If it is a bug in your version, ,all I can say is that it isn’t present in 4.7.8

Any reason why you are forced to stay on such on old release? ]

2 Likes

yes, the company policy :slight_smile:

I found the reason. It is a bit embarassing, but maybe it is useful for others in a similar context.

Knime does what is expected, but the row height allows to show the first substrings only . If one copies the cell into an editor, it will be clear that everything is there.

Thanks everyone for the help.

3 Likes

well we’ve all been there I guess… but it still sucks :wink:

1 Like

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