How to sum in Grouping table

28 views
Skip to first unread message

Ari Sobel

unread,
May 26, 2020, 10:29:48 AM5/26/20
to ReportBro
I want to sum subtotal in each group brake, 
Its bringging the full total....


Is it possible to make that sub-group calculation?

Alex Hartmann

unread,
May 26, 2020, 11:32:23 AM5/26/20
to ReportBro
You have to calculate the sub-group sums yourself and store it along your other row data.

an example for groups can be seen in the demo

the table has two content rows, and one row has a group expression set. This row is only
printed when the group expression changes.

To show group sums create a parameter list, e.g. with the following fields
"name", "group", "price", "group_price"

test data could look like
"apple", "fruits", 2, 2
"orange", "fruits", 3, 5
"banana", "fruits", 2, 7
"tomato", "vegetables", 3, 3
"potato", "vegetables", 1, 4
"salad", "vegetables", 2, 6

so the last value is the current group sum, when the group changes this value will be used (-> group_price for fruits is 7, group_price for vegetables is 6)

create a table with 2 content rows, the last content row has the group expression set for ${group} and in the row cell you can print the ${group_price}

Alex

Ari Sobel

unread,
May 26, 2020, 12:06:32 PM5/26/20
to Alex Hartmann, ReportBro
Dear Alex,

thanks a lot - i will try to implement it.

I am using web2py.

I am still in doubt how to get the data. Its json based?


Best regards
Ari

--
You received this message because you are subscribed to the Google Groups "ReportBro" group.
To unsubscribe from this group and stop receiving emails from it, send an email to reportbro+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/reportbro/3b90345f-8152-4832-9c72-d2745b5445f8%40googlegroups.com.

Alex Hartmann

unread,
May 27, 2020, 8:21:36 AM5/27/20
to ReportBro
Since reportbro is a Python Lib the data itself is a dict of python types (list, dict, int, str, ...) depending on the parameter types defined in the designer.

When the data is sent from the Designer for preview (test data) then it is sent as json and on the server side converted to python.

Have a look at the demo app for web2py:

this is a simple app which covers the basic parts for integrating ReportBro.

Alex
To unsubscribe from this group and stop receiving emails from it, send an email to reportbro+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages