Changing a flow variable type

I am trying to control my group by columns through an app. I am trying to pass a list of columns selected through Multiple Selection Widget to my group by node. However group by node accepts list but the selection is passing as a string. How do i convert this string to a list?

Okay so using Table Row to variable i am able to create a list and pass it to group by, yet the error is there for more than one strings that happen to be in a list
This is the warning i get and the node’s execute is greyed out.
WARN : KNIME-Worker-115-Table Row to Variable 6:21:0:29 : : Node : GroupBy : 6:21:0:25 : Group column ‘a,b,c,d’ not in spec.

I observed that the list has a space between two values

For example : [a, b, c, d] instead of [a,b,c,d]
How can i convert [a,b,c,d] a variable to [a, b, c, d] a list?

Hi
lists can be created several ways. E.g. by splitting a string based on spaces,commas etc (Cell splitter node could do that or groupby node).
Certain variable configurations require lists instead of single string values (as you already pointed out)
By default a list does not add spaces in between values if there are no spaces in the input you used to create the list.
If you like to add spaces then have a look at string manipulation node.
br

I tried but as the name suggests it is a string manipulation and doesn’t work on lists. If i am able to somehow convert my string variable to a list variable my work would be done, i guess.

You can use the ungroup node to split the list into multiple rows and then apply string manipulation to that column
br

Manipulation is not an issue. The output of any string manipulation is going to be a string. The flow variable that i need to call in my groupby node accepts only a list and that too the one with a space after every column name. That is the issue currently

Still there is issue :frowning:

I just don’t know what’s the issue now. The table Row to variable gives me a list but that list is not getting recognized in the groupby flow variable. However it takes the entire dataset value which comes from the component input.

Can someone guide me with this? Thanks!

Hi @r_jain
Take a look at this example I’ve with what I understood from your example. Please let me know if this works. You can download the workflow to see the step by step.

2 Likes

I’ve updated the flow so you can have the auto-fill of the widget with all the columns from the input table:

1 Like

That’s great. This seems to have done the trick! I didn’t create a collection column just after column header since it is only going to be used once in the groupby flow variable. In the first table row to variable i just took the flow variable (included_names) in my multiple selection widget as my possible choices and from there on the collection column worked.

Thanks a lot!

2 Likes

The solution is working on local but on server its not working.

Any idea why the fields don’t show up on the server?

So i have figured out the issue. Turns out the components had to be separated out and we should reset the multiple selection widget onwards just to get the fields in.

If we upload by doing a reset before upload it doesn’t work which is strange considering the values should be taken during a fresh compile. Might have to understand a bit more on this.

1 Like

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