Column summation

City Project Amount Count
Carthago Gladiators 452.00 $ 9
Gladiators 982.00 $ 0
Taxes 231.00 $ 1
Taxes 768.00 $ 2
Neapolis Army 6.00 $ 0
Army 169.00 $ 3
Arts 805.00 $ 6
Olympia Gladiators 339.00 $ 3
Taxes 689.00 $ 8
Roma Arts 942.00 $ 6

The table above shows a simple report, grouped by the "city" value, and with some amount.

The following tables are based on the same code, with the only addition of a table decorator org.displaytag.decorator.TotalTableDecorator.

The decorator will generate totals for any column with the total attribute set, and subtotal rows by grouping using the column with a group attribute set to 1.


Group by city, total for amount and count

City Project Amount Count
Carthago Gladiators 452.00 $ 9
Gladiators 982.00 $ 0
Taxes 231.00 $ 1
Taxes 768.00 $ 2
Carthago subtotal2433.00 $12
Neapolis Army 6.00 $ 0
Army 169.00 $ 3
Arts 805.00 $ 6
Neapolis subtotal980.00 $9
Olympia Gladiators 339.00 $ 3
Taxes 689.00 $ 8
Olympia subtotal1028.00 $11
Roma Arts 942.00 $ 6
Roma subtotal942.00 $6
Total5383.00 $38

Group by project and city, totals for amount only, customize labels.

Project City Amount Count
Army Neapolis 6.00 $ 0
169.00 $ 3
partial amount175.00 $
Arts 805.00 $ 6
Roma 942.00 $ 6
partial amount1747.00 $
Gladiators Olympia 339.00 $ 3
Carthago 452.00 $ 9
982.00 $ 0
partial amount1773.00 $
Taxes 231.00 $ 1
Olympia 689.00 $ 8
Carthago 768.00 $ 2
partial amount1688.00 $
full total5383.00 $

Totals for amount and count, without groups.

City Project Amount Count
Carthago Gladiators 452.00 $ 9
Carthago Gladiators 982.00 $ 0
Carthago Taxes 231.00 $ 1
Carthago Taxes 768.00 $ 2
Neapolis Army 6.00 $ 0
Neapolis Army 169.00 $ 3
Neapolis Arts 805.00 $ 6
Olympia Gladiators 339.00 $ 3
Olympia Taxes 689.00 $ 8
Roma Arts 942.00 $ 6
5383.00 $38