Min/Max functions do not work for firstn() and lastn() aggregation
book
Article ID: KB0079223
calendar_today
Updated On:
Description
I want to obtain the maximum or minimum last N values from a list in an aggregate context. For example..
max(lastn(4, MyField))
..produces a typecheck error in Studio ("not a valid aggregate expression").
Resolution
These errors occur because max() and min() functions cannot accept lists as input arguments. Instead, use maxelement()..
maxelement(lastn(4, MyField))
Issue/Introduction
Min/Max functions do not work for firstn() and lastn() aggregation
Additional Information
For reference, our List-related functions are noted in the Help under StreamBase Home > StreamBase References > StreamBase Expression Language Functions > (sub-heading) Simple Functions: Lists:
https://docs.tibco.com/pub/sb-cep/7.7.3/doc/html/reference/expressions.html
Feedback
thumb_up
Yes
thumb_down
No