Forums

Total (sum) Column

vividal 10 Mar, 2019
My issue seems so simple and I found hints at how to do it in a few forum threads but I can't make it work.

I have a table (Player_Table) is populated by a function read_players. It lists the players names and the 'amount' they have paid. The table works fine. I want to place a TOTAL (sum of the column 'amount') at the bottom of the table but I can't figure out how to do it (or at least make it work).

I saw something about sum(model.field):model2.sumvalue but I can't figure out where I am supposed to place it (view:field?)

thanx for a push in the right direction.
healyhatman 10 Mar, 2019
1 Likes
You can't place it at the bottom of the table itself, it will have to be a separate view that you put after the table.
You'll want a separate data read, with SUM(model.field):alias.aliasfield - replace Model with the data model, and alias / aliasfield with whatever you want.
Set this data read to first matching.

Then in your new summary view, for example a Custom HTML view, you use {var:read_data_name.alias.aliasfield}
vividal 11 Mar, 2019
I understand the placement being not in the original table and having a separate read function but what isnt clear to me is where am I placing "SUM(model.field):alias.aliasfield" in the new read data-if so where? Sorry again as I suspect this is easy but I just dont see it.
vividal 11 Mar, 2019
Brilliant!!! Thank you, does exactly what I was looking for. Knew it was easy. Now on to my next challenge.

thanx!!!
This topic is locked and no more replies can be posted.