How to use string column datatype flow variable in python script

I wanted to use my column dynamically so that when user changes the input , I get summaries accordingly. For that I have used python script node to group by on the columns which depends on the user . For that I have used column filter configuration.
The problem which I am facing that I am not able to use the flow variable in the python script .

1 Like

Hi,

The flow variables are in the flow variable window in the Python Script node
image

But before they appear in that window you have to “make” them with some node like “Table row to variable” or “Table column to variable”.

Hope this help you in some way.

2 Likes

Hello @ruks,

welcome to KNIME Community!

Maybe this example workflow can help:

It shows how to control GroupBy node using flow variables.

Br,
Ivan

Hi,

I think the general problem is that using the column selection configuration node, the derived flow variable is always a string, no matter if the selected column is numeric in the nodes beforehand.
Example:

image

Applying the “column selection configuration” node:

image

Within a python script, one cannot use the “string type” flow variable for numeric operations.

image

Is there a general solution for that? I stumbled upon the same problem, building a flexible component for certain statistics based on a python script.

Best regards,
Stiefel

It’s me again,

I worked out a solution, that might help.
Instead of the node with a variable output “column selection configuration”, I used the table output node “column filter configuration”.
After a user selected the desired columns over component dialogue, the selected columns can be renamed to a generic column name via extract column header nodes, e.g. “Key Figure”. This way the python script automatically can pick up the desired column, i.e. “Key Figure”, to do its work.

Find screenshoted solution attached:

image

Cheers,

Stiefel

1 Like

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