Hello guys! Just small and noob question, how can ...
# exposed
s
Hello guys! Just small and noob question, how can I retrieve the "sum" value in the result row when using groupBy?
For example like this:
Copy code
ProductVo.slice(ProductVo.reference,ProductVo.quantity.sum())
                .selectAll()
                .groupBy(Prouct.reference)
I can retrieve productVo.reference with:
Copy code
map { it[ProductVo.reference] }
But no the "quantity sum" value, I've tested with alias but didn't work
I can get the value by using
data[1]
but... it's a workaround
o
groupBy
is a map from key to list of values, you might want
associateBy
s
Will take a look
t
Copy code
val qSum = ProductVo.quantity.sum()
ProductVo.slice(ProductVo.reference, qSum)
                .selectAll()
                .groupBy(ProductVo.reference)
               .map{ it[qSum] }
🔝 1
s
ahhhhh, thanks! I'm stupid haha