MasterGroupHeaderBand
MasterDetailBand
MasterGroupFooterBand
MasterFooterBand
DetailBand
I would like to show the result of a Sum on a field in the DetailBand in the MasterDetailBand, MasterGroupFooterBand, and MasterFooterBand. When I use Sum([DetailTable].[Field]) in any of the master footer bands I seem to get a sum of one detail record per master record, rather than all detail records.
Below is a sample report based off the Demo.xml data set that illustrates what I am trying to accomplish.
Thank you very much.
Code: Select all
Connection
Connection
C:\Development Tools\Stimulsoft Reports.Net 2011.3 Trial\Bin\Data\Demo.xml
C:\Development Tools\Stimulsoft Reports.Net 2011.3 Trial\Bin\Data\Demo.xsd
Auto
Rank,System.Double
Country,System.String
Year2009,System.Double
Year2005,System.Double
Year2000,System.Double
Auto
Connection.Auto
Categories
CategoryID,System.Int32
CategoryName,System.String
Description,System.String
Picture,System.Byte[]
Categories
Connection.Categories
Countries
CountriesID,System.Int32
Flag,System.Byte[]
CountryName,System.String
Countries
Connection.Countries
Customers
CustomerID,System.String
CompanyName,System.String
ContactName,System.String
ContactTitle,System.String
Address,System.String
City,System.String
Region,System.String
PostalCode,System.String
Country,System.String
Phone,System.String
Fax,System.String
Customers
Connection.Customers
Employees
EmployeeID,System.Int32
LastName,System.String
FirstName,System.String
Title,System.String
TitleOfCourtesy,System.String
BirthDate,System.DateTime
HireDate,System.DateTime
Address,System.String
City,System.String
Region,System.String
PostalCode,System.String
Country,System.String
HomePhone,System.String
Extension,System.String
Photo,System.Byte[]
Notes,System.String
ReportsTo,System.Int32
Employees
Connection.Employees
GlobalGrowth
Region,System.String
Year2006,System.Double
Year2007,System.Double
Year2008,System.Double
Year2009,System.Double
GlobalGrowth
Connection.GlobalGrowth
Opec
Year,System.Double
Iran,System.Double
Iraq,System.Double
Kuwait,System.Double
Saudi_x0020_Arabia,System.Double
UAE,System.Double
Venezuela,System.Double
Libya,System.Double
Nigeria,System.Double
Opec
Connection.Opec
Order Details
OrderID,System.Int32
ProductID,System.Int32
UnitPrice,System.Decimal
Quantity,System.Int16
Discount,System.Single
Order Details
Connection.Order Details
Orders
OrderID,System.Int32
CustomerID,System.String
EmployeeID,System.Int32
OrderDate,System.DateTime
RequiredDate,System.DateTime
ShippedDate,System.DateTime
ShipVia,System.Int32
Freight,System.Decimal
ShipName,System.String
ShipAddress,System.String
ShipCity,System.String
ShipRegion,System.String
ShipPostalCode,System.String
ShipCountry,System.String
Orders
Connection.Orders
Products
ProductID,System.Int32
ProductName,System.String
SupplierID,System.Int32
CategoryID,System.Int32
QuantityPerUnit,System.String
UnitPrice,System.Decimal
UnitsInStock,System.Int16
UnitsOnOrder,System.Int16
ReorderLevel,System.Int16
Discontinued,System.Boolean
Products
Connection.Products
Shippers
ShipperID,System.Int32
CompanyName,System.String
Phone,System.String
Shippers
Connection.Shippers
States
Name,System.String
USPS,System.String
Population,System.Int32
Capital,System.String
States
Connection.States
Suppliers
SupplierID,System.Int32
CompanyName,System.String
ContactName,System.String
ContactTitle,System.String
Address,System.String
City,System.String
Region,System.String
PostalCode,System.String
Country,System.String
Phone,System.String
Fax,System.String
HomePage,System.String
Suppliers
Connection.Suppliers
Orders
OrderID
Orders
Orders
OrderID
Order_Details
OrderID
Order_Details
Order_Details
OrderID
EngineV2
None;Black;2;Solid;False;4;Black
Transparent
Transparent
0,0.2,7.72,0.3
None;Transparent;1;Solid;False;4;Black
Transparent
0,0,2.1,0.2
Arial,12,Bold
0,0,0,0
Text1
{Orders.CustomerID}
Black
{Orders.CustomerID}
GroupHeaderBand1
Transparent
0,0.9,7.72,0.3
None;Transparent;1;Solid;False;4;Black
Transparent
1.9,0,1.7,0.2
Arial,12,Bold
0,0,0,0
Text2
{Orders.OrderID}
Black
None;Transparent;1;Solid;False;4;Black
Transparent
5.8,0,1.9,0.2
Arial,12,Bold
3c99e5c0b69e4358a34a10de9082be81
0,0,0,0
Text10
{Sum(Order_Details.Quantity)}
Black
Expression
None;Transparent;1;Solid;False;4;Black
Transparent
4.5,0,1.3,0.2
Arial,12,Bold
9245b1746b074f1d94c1e89d08b03dd6
0,0,0,0
Text11
Qty for Order ID:
Black
Expression
Orders
DataBand1
Transparent
0,1.6,7.72,0.3
None;Transparent;1;Solid;False;4;Black
Transparent
5.8,0,1.9,0.2
Arial,12,Bold
f01a2aefdeeb42c399483b6d893c9618
0,0,0,0
Text7
{Sum(Order_Details.Quantity)}
Black
Expression
None;Transparent;1;Solid;False;4;Black
Transparent
4.1,0,1.7,0.2
Arial,12,Bold
0,0,0,0
Text8
Qty for Customer ID:
Black
Expression
GroupFooterBand1
Transparent
0,2.3,7.72,0.3
None;Transparent;1;Solid;False;4;Black
Transparent
5.8,0,1.9,0.2
Arial,12,Bold
e970ecbde2e5498296081d077aa7e048
0,0,0,0
Text4
{Sum(Order_Details.Quantity)}
Black
Expression
None;Transparent;1;Solid;False;4;Black
Transparent
4.9,0,0.9,0.2
Arial,12,Bold
9ca1d928c7514e95a25815e61e1286eb
0,0,0,0
Text9
Total Qty:
Black
Expression
FooterBand1
Transparent
True
0,3,7.72,0.2
None;Transparent;1;Solid;False;4;Black
Transparent
2.5,0,2,0.2
Arial,12,Bold
0,0,0,0
Text6
{Order_Details.Quantity}
Black
Orders
Order Details
DataBand2
Transparent
0,3.6,7.72,0.2
Top;Black;1;Solid;False;4;Black
Transparent
2.5,0,1.9,0.2
Arial,12,Bold
2ac42e1dbe1e4c8aa7596641df2938c2
0,0,0,0
Text5
{Sum(Order_Details.Quantity)}
Black
Expression
FooterBand2
d8885812eb6c4a3fb6f6490853025f5d
0.39,0.39,0.39,0.39
Page1
11
8.5
Letter
Arial,100
[50:0:0:0]
System.Dll
System.Drawing.Dll
System.Windows.Forms.Dll
System.Data.Dll
System.Xml.Dll
Stimulsoft.Controls.Dll
Stimulsoft.Base.Dll
Stimulsoft.Report.Dll
Report
12/14/2011 5:19:36 PM
12/14/2011 4:48:55 PM
C:\Development Tools\Stimulsoft Reports.Net 2011.3 Trial\MasterDetailSum.mrt
ab2cd2d07e364da5aefaab791f7aec95
Report
Inches
2011.3.1200
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Data;
using Stimulsoft.Controls;
using Stimulsoft.Base.Drawing;
using Stimulsoft.Report;
using Stimulsoft.Report.Dialogs;
using Stimulsoft.Report.Components;
namespace Reports
{
public class Report : Stimulsoft.Report.StiReport
{
public Report() {
this.InitializeComponent();
}
#region StiReport Designer generated code - do not modify
#endregion StiReport Designer generated code - do not modify
}
}
CSharp