Working with SubTotals
Top  Previous  Next

SubTotals are very useful for calculating the total of a specific group, or for the entire report. In this exercise, we will create a subtotal for the weight of our equipment list.

To do this, open the Prep Sheet report. Place your mouse cursor over the area where the Group Footer(0). meets Group Footer(1).

Click and drag downwards to expose the data space of Group Footer(1).

Now put a reportdbcalc DBCalc data component in the Group Footer(1), and make sure that it remains selected. From then click on the drop down combobox select the field Type-weight.

reportssubtotal

Now right click on the DBCalc component and select Calculations. Set the two options to be the same as the screen grab below:

reportssubtotal2

Finally, select the DBText component in the Details band that is used to print the weight of a piece of equipment. It's the fourth component from the left. Then, while holding down the Shift key select your newly added DBCalc component. You can now use the right alignment button on the Toolbar to correctly position the DBCalc component relative to the DBText component.

If you now preview the report, provided you have entered weights for the equipment on the sample equipment list you will get a subtotal for the weight of equipment in each MasterCategory. By setting the Reset Group option to Group (1): MasterCategory-sortorder, we are telling the DBCalc component to reset itself to zero whenever the MasterCategory group changes it data.

Note: you will probably have noticed that there is a DBCalc component in the Summary Band. If you right click on it to inspect its calculations property you will see that the Reset Group option is blank. This is because this is the grand total for the weight that will print just once at the end of the report.

You can now close the report without saving changes if you do not want this feature added.