Sum in rowGroup
Sum in rowGroup
antoniocib
Posts: 277Questions: 62Answers: 1
Hi guys, I shot a few examples and on the form and I did not find the function that in rowGroup makes the sum, can you help me?
This question has accepted answers - jump to:
Answers
This example shows how to provide averages for each group. You can change the code to shwo the sum by removing
/ rows.count()
on line 20.Kevin
Hi Kevin,
Look there:
Return me an error:
in line 710:
The error is :
Uncaught SyntaxError: missing ) after argument list
You have two
'
together (''</td>'
)that is causing the syntax error. Remove one of them.Kevin
@kthorngren the sum return NaN..
the code js:
The output:
Read the
pluck()
docs. This is the data you want to pluck from the row data. You are using objects so change the5
to the data object you want to some.If you still get NaN then either provide a test case showing the issue or use console.log statements to debug what is happening in the function.
Kevin
@kthorngren this is the test case:
http://damoratraffico.netsons.org/kevin/scrivania1.html
Is the column you want to sum
"data": "epal",
? If so then change pluck topluck('epal')
.Kevin
@kthorngren if i want stamp the sum of epal and perd how i do?
@kthorngren i solved in this way
i'm so happy!!!! Thanks man for all ur support!!
Good, I'm glad you got it worked out!
Kevin
Hello! @antoniocib
I have the same problem, but I just want to add only one column (amount)
I tried it with the examples above but it still doesn't work
this is my code,(copy it from above and adjust it to mine)
rowGroup: {
var sumimporte = rows
.data()
.pluck('importe')
.reduce( function (a, b) {
return intVal(a) + intVal(b);
}, 0) ;
dataSrc: 'uuid'
},
sorry i'm very new to the subject, thanks
@sgalicia We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin
I have a similar problem. Please have a look at my testcase
Rowgroup on column 0 (= rubrieken.box).
On serverside:
I need to sum the last 3 columns (2020,2021,boekjr3). I am trying on the last. If dataSrc is set to vermogen_details.boekjr3, then group in return will be the sum I am looking for, but I need to group on the first column. In which case sum always returns 0. What am I doing wrong here?
Thank you
This example from this thread should help, it's showing how to add a sum value into the RowGroup header.
Colin
I am sorry Colin, but the answer is not there. I figured it out: using double pluck() solved the problem:
Thanks anyway.