max and min values using flow variable

I have a file contains sevaral columns inside of which there are several descriptors. I did a worflow to mange data of this file. In paritcular the first step is a loop in which I assigned a variable to each column containing numerical values (score). For each of these column I did some operation. The problem is that for each iteration i should identified the maximun and minimum values based on the values of a master column. I’ll try to explain better with an example.


column1 column2 column3 column4
region_001 3 5 8
region_002 1 6 75
region_001 4 7 4
region_004 6 2 24
region_001 11 5 45
region_002 3 33 3

The output should be:

-Iteration1 on column2

column1 max,min
region_001 11,3
region_002 3,1
region_004 6

-Iteration2 on column3

column1 max,min
region_001 7,5
region_002 33,6
region_004 2

-Iteration3 on column4

column1 max,min
region_001 45,4
region_002 75,3
region_004 24

I’m trying to use the groupby node to do that but I don’t know how to use a flow variable inside that one. Could someone help me please?

Hi @tommasopalomba

See this wf : max_min_values.knwf (43.6 KB). Indeed it uses a flow variable, but not in the GroupBy node (it may be possible), but I found a little bit different solution. The ConstantValue column node identifies from what column the min and max values are calculated (using a flow variable: current column name).

gr. Hans

oeps. I missed the discussion in this related forum topic: combining rows values based on other column


Closing this topic so we don’t have multiple conversations going about the same issue. Let’s keep the conversation going in the other thread.

1 Like