Wondering if there is a simple solution how to select lowest value from Group:Number:AVG ?
Item Temp1 (Temps) // 12
Item Temp2 (Temps) // 14
Item Temp3 (Temps) // 16
Average is 14, but lowest value is 12
Do I need a helper Item to store lowest value or there is a way how to select it directly from the Group Item?
Create another group with MIN instead of AVG
There is a way in rules but currently on my phone
yeah might be viable solution.
just need to update members so they will belong to two groups, good thinking. Thanks
minTempItem = Temps.members.sortBy[ state as Number ].head
Edit: Fixed error in original, I left off the “members” part.
thank you, both ways works nicely!
Cool, I was not aware of this possibility. Is it also possible to retrieve the first 3 entries by rules (something like head+1, head+2 or similar?)
Probably not but you could try the following in case the filter method supports an index argument like forEach does.
MyGroup.members.sortBy[ state as Number ].filter[ item, index | index < 3 ]
You could research Java Streams and figure out how to convert that knowledge to Xtend here (under the covers Xtend just uses the Java Streams).
Wouldn’t that be something like
var myList = minTempItem = Temps.members.sortBy[ state as Number ]
var firstItem = myList.get(0)
var secondItem = myList.get(1)
var thirdItem = myList.get(2)
but remember you are not guaranteed to get all or any of those.