The Report Design Document / Design How-To |
In your Genero BDL report application, define variables for the totals, calculate the values, and output them to the report engine.
DEFINE data store_order_data, --Add variables for totals store_total, order_total, item_total, report_total DECIMAL(10,2)
ORDER EXTERNAL BY data.orders.store_num, data.orders.order_numCalculate the group and report totals, and output them in the FORMAT section.
FORMAT --Add FIRST PAGE HEADER, BEFORE GROUP OFs FIRST PAGE HEADER LET report_total = 0 BEFORE GROUP OF data.orders.store_num LET store_total = 0 BEFORE GROUP OF data.orders.order_num LET order_total = 0 ON EVERY ROW --Add statements to calculate totals LET item_total = data.items.price*data.items.quantity LET order_total = order_total + item_total LET store_total = store_total + item_total LET report_total = report_total + item_total PRINT data.*, order_total, store_total, report_total
Figure 1. Example Report Structure
In this example, the order_total Stripe is the last child of the Group order_num, the store_total Stripe is the last child of the Group store_num. The report_total Stripe was dropped onto the Page Root, the main page for the report. This positions the Stripe as a child of the Page Root, and will place it at the very bottom of the child list for that trigger.
On each change of data, the specified data for every corresponding row will print out, and the appropriate Stripe will print out after each change of Group. The report_total Stripe will be the last thing to print out on the report. The values of any data objects in the Stripe will be taken from the immediately preceding row of data (the last report line of the container for onEveryRow trigger.)