Creating a total

Top  Previous  Next

We will look at using the total function as an example. Let us create the "master-detail" report that uses two tables - "Categories" and "Products":

 

totalReport1

 

The prepared report will be as follows:

 

totalReport1Result

 

Let us add total in this report which will be printing the total quantity of units in stock for each category - sum of "UnitsInStock" data column. Total will be printed in the "Data Footer" band.

 

To print total value, you need to create it first. For this, press "Action" button in the "Data" window, and choose the "New total" item. Another method - right click the "Totals" element in data tree and choose "New total" menu item. You will see the total editor window.

 

totalEditor

 

First of all, you will be asked to indicate total's name. You will be referring to the total by its name, so name the total in such a way that it will be easy to understand as what it calculates. Let us call our total as "TotalUnits".

 

Then we choose the "Sum" function for the total.

 

Now we need to indicate data range for which total will be calculated. For that in "Evaluate on each row of the band:" field, we choose the "Data" band in which a list of products is printed. In the "Print on the band:" field we choose a band in which total will be printed - that is, the "Data Footer" band.

 

Close editor by pressing OK button. You will see the new total appears in the "Data" window. Now you can drag it into the report:

 

totalReport2

 

When we run the report, we will see the following:

 

totalReport2Result