Best Way to Get Summary Information in the Group Footer and Summary Bands
I have a report that is based upon 3 tables that are provided to RB using a
single query.
Simplistically, the tables and their relationship are as follows:
Orders
Item (linked to Orders by Ord_No)
Product (linked to Item by Prod_No)
The query is as follows:
'SELECT YEAR(o.Ord_Date) AS Yr, MONTH(o.Ord_Date) AS Mo, ',
' i.Prod_No, i.Itm_Qty, i.Itm_Total$, i.Itm_Fee$, i.Itm_Disc$,
',
' IFNULL(i.Itm_Total$,0) - IFNULL(i.Itm_Fee$,0) -
IFNULL(i.Itm_Disc$,0) AS Itm_Net$, ',
' i.Itm_Qty * p.Prod_Qty AS TotalQty, ',
' p.Prod_Name, p.Prod_Version, p.Prod_Qty, ',
' p.Prod_Name + p.Prod_Version + Char(p.Prod_Qty) AS Product ',
' FROM Orders o, Item i, Product p ',
' WHERE o.Ord_No = i.Ord_No AND ',
' i.Prod_No = p.Prod_No ',
' ORDER BY YEAR(o.Ord_Date), MONTH(o.Ord_Date), p.Prod_Name,
p.Prod_Version, p.Prod_Qty ');
The report has three groups and no detail band is used.
Group Footer[2] summarizes data by Product
Group Footer[1] summarizes data by Mo
Group Footer[0] sumamrizes data by Yr
Summary has a grand total.
The above works as needed but I would like to insert into Group Footer [0],
a summary of the data by Product for that Yr. In the summary band, I would
like to insert a summary of data by Product.
What is the best way to accomplish this? Subreport, variable (how do I
handle with products that are not fixed categories as in the demos?), ?
TIA for any suggestions,
Tom
single query.
Simplistically, the tables and their relationship are as follows:
Orders
Item (linked to Orders by Ord_No)
Product (linked to Item by Prod_No)
The query is as follows:
'SELECT YEAR(o.Ord_Date) AS Yr, MONTH(o.Ord_Date) AS Mo, ',
' i.Prod_No, i.Itm_Qty, i.Itm_Total$, i.Itm_Fee$, i.Itm_Disc$,
',
' IFNULL(i.Itm_Total$,0) - IFNULL(i.Itm_Fee$,0) -
IFNULL(i.Itm_Disc$,0) AS Itm_Net$, ',
' i.Itm_Qty * p.Prod_Qty AS TotalQty, ',
' p.Prod_Name, p.Prod_Version, p.Prod_Qty, ',
' p.Prod_Name + p.Prod_Version + Char(p.Prod_Qty) AS Product ',
' FROM Orders o, Item i, Product p ',
' WHERE o.Ord_No = i.Ord_No AND ',
' i.Prod_No = p.Prod_No ',
' ORDER BY YEAR(o.Ord_Date), MONTH(o.Ord_Date), p.Prod_Name,
p.Prod_Version, p.Prod_Qty ');
The report has three groups and no detail band is used.
Group Footer[2] summarizes data by Product
Group Footer[1] summarizes data by Mo
Group Footer[0] sumamrizes data by Yr
Summary has a grand total.
The above works as needed but I would like to insert into Group Footer [0],
a summary of the data by Product for that Yr. In the summary band, I would
like to insert a summary of data by Product.
What is the best way to accomplish this? Subreport, variable (how do I
handle with products that are not fixed categories as in the demos?), ?
TIA for any suggestions,
Tom
This discussion has been closed.
Comments
Usually when trying to keep track of summary information throughout a
somewhat complex report, you need to use TppVariables. For instance, if you
were trying to keep track of the total sales for each product, place a
variable next to each product in the detail band and inside its OnCalc
event, update another variable in the group footer with the new total for
that product. The first variable doesn't need to be visible, you only need
it for its OnCalc event (which essentially fires only once for each time
it's generated.
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com