Original: ActiveReports Report application Tutorial (6)---grouped report
You can set up single-level groupings, nested groupings in ActiveReports, and you can group data sources by using data region controls such as tables, lists, and matrices. The application of the group report in the Business Report system is numerous, the Customer Information classification statistics table, the Commodity sorting table, the sales record year, the reading statistic and so on. This article describes how to implement grouped reports in ActiveReports.
1. Create a report file
Add a activereports report file to the application, using the project template type of ActiveReports page report. After adding is complete, select the Report Properties menu item from the VS Report menu and set the report page margin to 1cm in the Appearance tab
2. Open Report Explorer and follow the information below to create a report data source
Name:
Nwind_chs
Type:
Micorsoft OLE DB Provider
OLE DB provider:
Microsoft.Jet.OLEDB.4.0
Server or file name:
Data\nwind_chs.mdb
3. Add data sets
On the new Nwind_chs data source, right-click and select the Add DataSet menu item, the dataset information is as follows:
General-Name: Products
Query-query:
SELECT products. *, category. Category name, category. Description as category description, category. Picture as category picture, supplier. Company name as supplier, supplier. Contact name, supplier. City, supplier.
From (vendor INNER join product on vendor. Vendor ID = product. Vendor ID) INNER Join category on product. Category ID = category. Category ID
ORDER by product. Category ID;
4. Design the report interface
Select the first page of the report Page1, click the Properties dialog Box command link in the Properties Window command area, and set the following information in the Settings dialog box that appears:
General-Data set name:
Products
Grouping-Expressions:
=[category name]
4.1. From the VS Toolbox, add the Table control to the report design interface, set the Table1 fixedsize to 19cm * 25cm, and follow the information for each data cell's properties:
cell row and column index
Control
Property
cells[1,1]
Textbox
Value=first (fields! category name. Value) & "(" & First (fields! category description.) Value) & ")"
cells[3,1]
Textbox
value=fields! Product name. Value
cells[3,2]
Textbox
Value=fields! number of units. Value
cells[3,3]
Textbox
value=fields! unit Price. Value
cells[3,4]
Textbox
value=fields! order quantity. Value
cells[3,5]
Textbox
value=fields! re-order quantity. Value
cells[3,6]
Textbox
value=fields! unit Price. Value * fields! order quantity. Value
cells[3,7]
Image
Value=iconset ("Symbols2", fields! abort. Value = 0,false,fields! abort. Value * -1,false,false)
cells[4,5]
Textbox
Value=sum (fields! order quantity. Value, "Table1")
cells[5,5]
Textbox
Value=sum (fields! stock. Value, "Table1")
cells[6,5]
Textbox
Value=sum (fields! unit price. Value * fields! order quantity. Value, "Table1")
The resulting design interface looks like this:
5. Running the program
Run the program with the F5 key to get the following running results:
Online demo and source code:
Http://www.gcpowertools.com.cn/products/activereports_demo.htm
ActiveReports Report Application tutorial (6)---grouped reports