Getting KNIME to recognise List or Collection format for data from an external file

I want to read a file which has data in a format similar to the KNIME "list" or "Collection" format after conversion to string type (e.g. a single entry is written as  [a,b,c,d,....]). I want KNIME to be able to interpret each such data entry as Collected data, so I can then Ungroup it. However I can't see an easy way to get KNIME to assign the Collection data type to this data. Column Rename is not able to do this.

             Many thanks in advance for any help.

                        John

                           

                

 

 

In a java snippet you could do the following:


String vals = c_Values;

// Remove the first bracket 
vals = vals.substring(1, vals.length());
// output just so we can see what happens
out_step1 = vals; 
// Remove the end bracket
vals = vals.substring(0, vals.length() -1);
// output just so we can see what happens
out_ste2 = vals;

// Split the collection based on the seperator
// in this case the seperator is ', ' (comma space)
out_Collection = vals.split(", ");

 

Where c_Values is the column values with a format like [a, b]

This will convert the string [a, b] into a collection cell storing a and b

 

Example 2 node workflow attached

 

Thank you very much ,

   That works for me. I just need to be careful to use a separator that cannot appear in my data.

                         John