Convert ALL Collections to Strings

Hi,

since one cannot write collections with the CSV Writer (why not just write a sensible default representation?), it is probably a very common task to get all collection columns to strings.
I want to do this without loops (slow & ugly) and without extensions (e.g. Vernalis; to reduce dependencies).

Unfortunately, there was never a follow-up on String Manipulator Multi-Column and Lists and neither is it fixed in 4.6

Any other ideas?

Thank you in advance

I think Collection to String node allows you to do that
Have you tried it
br

Hi @jpfeuffer , the obvious solution here is to use the ‘Collection to String Node’ as suggested by Daniel up there. But since you mentioned you don’t want to depend on (Vernalis) extension(s), here’s a “cheat” via the String Manipulation Node that you can do:

Using this setting:

Here’s an example of the result:

Let me know if you’re caught up somewhere still.

UPDATE: If you need to apply it to multiple columns, you can use the String Manipulation (Multi Column) version instead, where you can select/deselect the collection columns you want to apply the manipulation onto.

1 Like

Thanks a lot for all your suggestions!
Unfortunately, I could not make the String Manipulation (Multi Column) trick work because it does not let me select Collection columns :frowning:
Similar to what was reported here: String Manipulator Multi-Column and Lists

Hi @jpfeuffer , in that case you can use Column List Loop Start + String Manipulation + Loop End.

(There’s a possibility that Loop End (Column Append) Node is needed for your case instead of Loop End. But you’ll have to test it out yourself and see what comes out.)

Hi!
But how do you use variables as column names in the String Manipulation node?

There were no variables in the example I showed.

Ok, but how do you specify which column to convert in the String Manipulation node inside the loop? They all have different names.

The Column List Loop will loop through all available columns in your table.

But I only want to convert Collections, so I selected Type = Collection in the Column Loop Start.
The behaviour is now, that all columns are present, but always only one of the Collection columns.

Even if I chose “loop through all columns”, how would I tell the String Manipulation node to access the first and only column?

Okay, it wasn’t until I tried it for myself that I encountered the naming issue. I have tested another workaround that doesn’t involve String Manipulation Node or Looping. Here’s how I did it:

PF

Here are the configurations:



Here are the results:


Basically this trick joins all your collection columns to one big set (of string type). Then the Cell Splitter separates them to individual collections as the original, but this time it will be in the String type as you desired.

Note: In this example I used _ (underscore) as the separator. You can choose your own separator as long as it’s not a comma or any other character that exists in your collection elements.

Hope this helps!

1 Like

Oh yes, this looks very promising! Thank you!

No worries. If you need the original column headers, you’ll have to rename the columns.

Have a good day!