In ActiveReports, you can set single-level groups and nested groups. You can also use data area controls such as tables, lists, and matrices to group data sources. Grouping reports are widely used in the business report system, including the customer information classification statistics table, commodity classification statistics table, sales record year, and reading statistics. This article describes how to implement grouping reports in ActiveReports.
1. Create a report file
Add an ActiveReports report file to the application. The project template type is ActiveReports page report. After adding a report, select the report attribute menu item from the VS report menu, and set the report margin to 1 cm on the appearance tab.
650) this. width = 650; "width =" 644 "height =" 308 "title =" ActiveReports report function display fixed page reports "style =" border-width: 0px; display: inline; "alt =" ActiveReports report function show fixed page reports "src =" http://www.bkjia.com/uploads/allimg/131228/2046133146-0.png "border =" 0 "/>
2. Open the report resource manager and create a report data source according to the following information:
| Name: |
NWind_CHS |
| Type: |
Micorsoft OleDb Provider |
| Ole db Provider: |
Microsoft. Jet. OLEDB.4.0 |
| Server or file name: |
Data \ NWind_CHS.mdb |
650) this. width = 650; "width =" 644 "height =" 576 "title =" ActiveReports report function display page report data source "style =" border-width: 0px; display: inline; "alt =" ActiveReports report function display page report data source "src =" http://www.bkjia.com/uploads/allimg/131228/2046134057-1.png "border =" 0 "/>
3. Add a dataset
Right-click the new NWind_CHS data source and choose add dataset from the shortcut menu. The dataset information is as follows:
General-Name: Products
Query-query:
SELECT
Product. *, category. category name, category. Description
AS
Category Description, category. Image
AS
CATEGORY image, vendor. Company Name
AS
Supplier, supplier. Contact Name, supplier. City, supplier. Address
FROM
(Supplier
INNERJOIN
Product
ON
Supplier. Supplier ID = product. Supplier ID)
INNERJOIN
Category
ON
Product. Category ID = category. Category ID
ORDERBY
Product. Category ID;
4. design the report page
Select Page1 on the first page of the report, click the link of the "properties" dialog box in the Command Area of the "properties" window, and set the following information in the displayed "Settings" dialog box:
| General-dataset Name: |
Products |
| Group-expression: |
= [Category name] |
4.1 Add the Table control from the VS toolbox to the report design interface, set the FixedSize of Table1 to 19 cm * 25 cm, and follow the following information about the attributes of each data cell:
| Cell row/column Index |
Widget |
Attribute |
| 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! Unit quantity. 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! Reorder 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! Inventory. Value, "Table1 ") |
| Cells [6, 5] |
TextBox |
Value = Sum (Fields! Unit Price. Value * Fields! Order Quantity. Value, "Table1 ") |
Shows the final design interface:
650) this. width = 650; "width =" 642 "height =" 386 "title =" ActiveReports report function display group report "style =" border-width: 0px; display: inline; "alt =" ActiveReports report function display group report "src =" http://www.bkjia.com/uploads/allimg/131228/2046131495-2.png "border =" 0 "/>
5. Run the program
Run the program by pressing F5 to obtain the following running result:
650) this. width = 650; "width =" 644 "height =" 443 "title =" ActiveReports report function display group report "style =" border-width: 0px; display: inline; "alt =" ActiveReports report function display group report "src =" http://www.bkjia.com/uploads/allimg/131228/2046134406-3.png "border =" 0 "/>
Online Demo and source code:
Http://www.gcpowertools.com.cn/products/activereports_demo.htm
650) this. width = 650; "width =" 644 "height =" 507 "title =" ActiveReports report function display "style =" border: 0px currentcolor; display: inline; "alt =" ActiveReports report function display "src =" http://www.bkjia.com/uploads/allimg/131228/20461353H-4.png "border =" 0 "/>
This article from the "grape city control blog" blog, please be sure to keep this source http://powertoolsteam.blog.51cto.com/2369428/1255837