Data in loop not the same as Loop End

Hi all,
I have a simple loop intended to remove carriage returns from string columns.

When I run it, the output of the String Replacer node seems like it’s run correctly, the carriage returns are replaced, and the iteration counter is at 14. However, the output table of the Loop End node does not have the updated strings, and the iteration counter column says 0.

Any hints as to what I’m doing wrong?

Hey there,

Can’t check in knime right now, but think you need Loop End (column append) if you use a column list loop start.

There are also some other hints in this older post:

Hi @MartinDDDD, thanks for the tip. The Loop End (column append) sort of works. The output table now has 14 iterations of all of my columns, and the final iteration does have all the columns fixed up.

It would need work to now clean out all the other version of the columns, and rename the final ones.

It feels like it should work with the Loop End node, but for some reason I can’t get it to.

Can you share the WF or a simplified example?

Happy to give it a go once I’m in front of a computer :slight_smile:

Another thought: can String Manipulation (multicolumn) do the job w/o loop?

You should be able to select columns by type string

Edit:

This should work w/o loop:

  1. Use column splitter to split out String cols
  2. Use String Manipulation to remove/replace whatever you need (note: if you remove e.g. \n etc. make sure you “double-escape” like this:
  3. "\\n"
  4. Column Append to put everything back together
    Here’s a prototype (think I replaced “s” as a simple example though):

removecarriagereturn.knwf (77.0 KB)

3 Likes

Wow, thanks again @MartinDDDD!

I’ve attached the workflow. Your solution would definitely work, however, ideally, the output would maintain the same column order, which is why I didn’t really want to split the columns out.
Remove All Carriage Returns.knwf (77.1 KB)

Just an updated that I’ve used your solution, and just wrapped it in a Reference Column Resorter node to maintain the column order. I never knew about this node before, and it’s going to be very handy!

Thanks again!

3 Likes

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