Find second maximum value of a column

Hi ,

I am trying to find second maximum value of a column data in a moving aggregation node.

Any help would be appreciated.Thanks


the simplest way I can think of is this: As aggregation method choose List (Sorted). Now use a Java Snippet (Simple) with code like the following:

int index = $ValueSortedList$.length - 2;
return $ValueSortedList$[index];

If you don't select Resolve missing values for incomplete windows, you could of course optimize, as the index is only dependant on your window length in this case, but that might introduce bugs later. So unless you define your window length with a flow variable anyway, I wouldn't necessarily recommend it.