Tutorial - Page 17
Printing dollar totals for a group of database information is very common in financial reports (i.e. What are the total dollar sales for all customers in a state?). The concepts described in the previous tutorial page are practically the same, with some slight changes to achieve the desired result:
¡ | Create the Sorting Band on the desired database field (in this case, the STATE database field) |
¡ | Create a Group Footer band on this same database field |
¡ | Create a new frame inside the Group Footer band |
¡ | Click the Dictionary button for this newly added Frame |
¡ | Click the '+' button at the top of the Dictionary dialogue box |
¡ | Create a new variable to contain the dollar total value based on the database field containing the dollar sales (for this example it is the database field NAM:Sales): |
* NOTE *
Remember that the variable LOC:StateTotal will be containing the SUM of the NAM:Sales database field! This means that the variable will most likely be larger (potentially MUCH larger) than the largest database entry; when assigning the Picture for the variable MAKE SURE you increase it's length to accomodate this situation. Otherwise your data contained in the variable may be incorrect due to truncation!
* NOTE *
After saving the new variable information your Dictionary screen will be updated:
And here is the Report Formatter screen:
And some sample output:
Naturally the database field for sales for each customer could be added to the Detail report band; one could also change the Picture for the "Total Sales" to include a leading dollar sign symbol. In fact, let's also add some lines to this report band to really spruce it up:
As shown above, the Sales information for each database record was added. Also added were a top border for the first frame (Total Records For The State) and a bottom border for the second frame (Total Sales For The State) located inside the Group Footer report band.
To recap: on this page you learned:
¡ | How to create a new variable for a Group Header / Group Footer report band |
¡ | How to use this variable to store numeric information (such as sales information) |
¡ | How to combine this variable with text to print attractive and meaningful report information |