ActiveReports Report Application Tutorials (7)---Cross-report and PivotChart plan implementation

Source: Internet
Author: User
Tags ole

In ActiveReports, the cross-report can be implemented conveniently by matrix control, and the data can be grouped, sorted, filtered, subtotal and aggregated, which can meet the requirements of intelligent data analysis for your report. The number of rows and columns of a group in a matrix control is determined by the number of unique values in each row grouping and column grouping. At the same time, you can group data by multiple fields or expressions in a row group and a column group. At run time, when you combine report data and data regions, the matrix grows horizontally and vertically on the page as columns are added to the column group and rows are added for row groups.

In a matrix control, you can also include a detail switch that initially hides the details data, and then the user can click the switch to display more or less detail as needed to implement the data drill down feature.

What we are going to demonstrate here is the product Sales data analysis table, grouped by product category and product name, grouping by year and month, and highlighting data with sales greater than 2000, the following is a detailed implementation step:

1. Create a report file

Create a activereports report file in the application named RPTCROSSTABLE1.RDLX, use the project template for the ActiveReports page report, and then select Convert to Continuous page layout (CPL) Report from the Report menu item of VS when the creation is complete To convert a pinned page report to a continuous page report.

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: Saledetails

Query-query:

SELECT t.*, category. Category name from (
INNER JOIN Order Details on order. Order ID = Order Details. Order ID)
INNER JOIN product on Order details. Product ID = product. Product ID)
INNER JOIN category on products. Category ID = category. Category ID) as T
INNER JOIN category on T. Category ID = category. Category ID
Order by order year, subscription month


4. Design the report interface

From the Visual Studio Toolbox, add the Matrix control under the ActiveReports 7 page Layout report category to the report design interface, and then select the Properties dialog box command from the command area of the Properties window to open the Properties Settings dialog box Then follow the table below to set the Matrix control's properties:

Matrix-General-DataSet name:
Saledetails

Row grouping-general-add Group:
Name: matrix1_ order Year
Group: =[order Year]
Expression: =[order Year]

Row grouping-general-add Group:
Name: matrix1_ Order Month
Group: =[Order Month]
Expression: =[Order Month]

Column grouping-general-add Group:
Name: matrix1_ category name
Group: =[category name]
Expression: =[category name]

Column grouping-general-add Group:
Name: matrix1_ Product Name
Group: =[Product Name]
Expression: =[Product Name]

After completing the above setup, go back to the report Design screen, select Data cell TextBox4, click the Properties dialog command in the command area of the Properties window, and set the properties of the data cell according to the following table:

General-Value:
=sum ([qty] *[Unit Price] * (1-[discount]))

Appearance-Background color-color:
=iif (sum ([Quantity] * [Price] * (1-[discount]) >) and (sum ([Quantity] * [Unit Price] * (1-[discount])) <> "," #c21952 "," W Hite ")

It is important to note that the appearance-background color-color property is highlighted in the form of an expression, and if the sales volume is greater than 2000 the cell background color is set to highlight, less than or equal to 2000 is set to white.

The final finished design interface is as follows:

5. Running the program

Run the program with the F5 key to get the following effect:

Online demo and source code:

Http://www.gcpowertools.com.cn/products/activereports_demo.htm

ActiveReports Report Application Tutorials (7)---Cross-report and PivotChart plan implementation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.