Column summation

City Project Amount Count
Neapolis Army 240.00 $ 5
Arts 857.00 $ 4
Arts 933.00 $ 5
Olympia Army 31.00 $ 9
Gladiators 895.00 $ 7
Taxes 120.00 $ 0
Roma Army 114.00 $ 2
Arts 119.00 $ 6
Arts 399.00 $ 3
Gladiators 489.00 $ 2

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
Neapolis Army 240.00 $ 5
Arts 857.00 $ 4
Arts 933.00 $ 5
Neapolis subtotal2030.00 $14
Olympia Army 31.00 $ 9
Gladiators 895.00 $ 7
Taxes 120.00 $ 0
Olympia subtotal1046.00 $16
Roma Army 114.00 $ 2
Arts 119.00 $ 6
Arts 399.00 $ 3
Gladiators 489.00 $ 2
Roma subtotal1121.00 $13
Total4197.00 $43

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

Project City Amount Count
Army Olympia 31.00 $ 9
Roma 114.00 $ 2
Neapolis 240.00 $ 5
partial amount385.00 $
Arts Roma 119.00 $ 6
399.00 $ 3
Neapolis 857.00 $ 4
933.00 $ 5
partial amount2308.00 $
Gladiators Roma 489.00 $ 2
Olympia 895.00 $ 7
partial amount1384.00 $
Taxes 120.00 $ 0
partial amount120.00 $
full total4197.00 $

Totals for amount and count, without groups.

City Project Amount Count
Neapolis Army 240.00 $ 5
Neapolis Arts 857.00 $ 4
Neapolis Arts 933.00 $ 5
Olympia Army 31.00 $ 9
Olympia Gladiators 895.00 $ 7
Olympia Taxes 120.00 $ 0
Roma Army 114.00 $ 2
Roma Arts 119.00 $ 6
Roma Arts 399.00 $ 3
Roma Gladiators 489.00 $ 2
4197.00 $43