Find max value and use corresponding/adjacent cell?

Hi, I've searched for a solution on this forum but haven't been able to find anything. Thanks in advance if you're able to lend a hand =)

I'm trying to find the max value from Col1, Col2, and Col3. Once found, I want its corresponding/adjacent cell to be outputted.

 

Col1      Col2     Col3      Col1-ADJ     Col2-ADJ       Col3-ADJ       Output
1960     1966    1968            B                    M                   P                  P
1966     1970       ?               B                    D                    ?                  D
1966     1968    1975           C                    M                    P                  P
1982     1972    1969           C                    P                    L                   C
1967     1969       ?               ?                    ?                    ?                   ?

You could do this over a couple of steps.

first use column aggregator node. Select columns a, b, and c to aggregate by, and choose to take the maximum value. Give the output column a name, i.e result.

now connect a rule engine node. Set up three rules in there;

if col1 = result column, then outcome should be col1-ADJ, making sure is a column reference is selected. repeat same procedure for col2 and col3.

give the output column a name, I.e. "output".

 

hope this helps, Simon.

Simon, this worked like a charm. Thanks so much!

Hi,

is there a way to do this over a collection of 220 column pairs (instead of the examples three column pairs)?

For example I tried to use the column list loop start node. But doing so, I can only include one column name iterating instead of the necessary two.

Thanks,

Manu

Hi Manu,

You can use the Java Edit Variable node to create the second column name as a flow variable (I assume it is related to the first in some way). Otherwise, you might use the Java Snippet node too.

Cheers, gabor