Still no solution to create list/collection/set with variables???

Continuing the discussion from Create a string collection flow variable:

Hello,
With the current KNIME version 5.2 I still can’t easily create a variable collection/list/set from given variables, right?
Would be great if it was at least possible via the variable expression node. Should be an easy integration and make life easier…

Best regards,
Martin

Hi @mkammerer -

As far as I know there’s not a newer way to do this. Your idea about the Variable Expressions node is a good one - possibly the Variable Creator node would also be a candidate.

I moved the thread to the Feedback & Ideas category so that you and others can vote on it.

1 Like

Hi @mkammerer ,

I agree that this is something that ought to be straightforward to do, and it feels that Variable Expressions ought to be able to create collection variables in the same way that Column Expressions can make collection columns.

Depending on your use case, the following component may be of assistance:

The idea is that you just enter the elements in a text box, one per line and it creates the collection variable from the list

A few months back, somebody here on the forum requested that something similar could be done to take a delimited string variable and convert that into an array, and so I wrote an adapted version, which effectively supersedes the functionality of the first one:

So this component can either be used manually as above, where you simply enter the values directly into the box, or alternative if you already have a string flow variable that contains delimited values, this can be used to create a collection using this component, by setting the textbox value via the flow variable tab:

2 Likes

Hi all & @mkammerer,

i found this topic interesting and took a shot. Here is a link to a version 5.2.1 compatible workflow: Create String Array Variable – KNIME Community Hub

In this workflow, I show how I handle the string to array variable problem. I never had the use case to merge variables into a string array but it was an interesting challenge.

I have created a component to solve it. It is used inside the workflow but also shared here for further usage: Variables to String[] Variable

The component works lets you filter the variables you want to merge into one String Array variable which you can also name.

I hope you find this useful :wink:

Best regards,
Julian

2 Likes

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