Flow variables: get length of string array

With KNIME 4.x, you can have flow variables of type String[], as created e.g. by the Column Filter Configuration node.

How can I get the number of elements in a String[] array variable?

The String Manipulation (Variable) and Variable Expression nodes don’t seem to accept string array variables and don’t show them as possible input.

As a workaround, I can consult the output table specs of the Column Filter Configuration and use the number of columns, but it would be good to know if there’s a more general way of counting elements in an array variable.

2 Likes

Hi @imagejan

this is currently not possible with Variable based nodes, like those you mentioned above. We will improve this and support the new variable types in more nodes with the next releases.

Best wishes, Iris

6 Likes

Just an addendum (in case someone else stumbles upon this when playing around with the Column Filter Configuration node):

For performing tasks further downstream related to the user choice of columns from the Column Filter Configuration, the Reference Column Filter and Reference Column Splitter nodes can be quite useful to avoid the need of any flow variable manipulations:

1 Like

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