Tutorial - Lesson 16

  Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic! Mail us feedback on this topic!  


While ComQuest doesn't concern itself with using dollar amounts for any reason, this lesson, which relates more to an Inventory/Sales application will be helpful, as it teaches you how to create and use a variable for calculating sums and totals. Printing dollar totals for a group of database information is very common in financial reports. The concepts described in the previous lesson 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. Select the Group Totals section under Gather Totals.
Click the '+' button at the top of the Dictionary dialogue box: RBPlusButton


Create a new variable to contain a count of states. Name it Loc:State and use the variable res:State as the field to total:



Adding a new sum variable


HandRemember that the variable LOC:StateTotal will be containing the SUM of the res:State 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 accommodate this situation. Otherwise your data contained in the variable may be incorrect due to truncation!


After saving the new variable information your Dictionary screen will be updated:



Dictionary with new total variable


And here is the Report Formatter screen:



Footer band with State sum counter


And some sample output:



Sum counter at bottom of report


To recap: in this lesson 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