Get the App
SLTechnology News&Howtos  ›  Development  › 

How to analyze the document directory of interactive reports in ActiveReports

Shulou Source: shulou.com Published: 2022-06-02 03:10:02 10月02日 Update

How to analyze the document catalogue of interactive reports in ActiveReports, I believe that many inexperienced people do not know what to do about it. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

Through the document directory, users can clearly view the report data structure, and can easily jump to the specified chapter, and finally export the report to PDF and other format files. Taking the 2012 monthly product sales classified summary report as an example, the following demonstrates how to implement the document catalog in the ActiveReports report control.

1. Create a report file

Create an ActiveReports report file named rptMonthlySalesByCategory.cs in the application, the ActiveReports area report (based on code).

2. Create a report data source

Click the icon to create the report data source. The data source we use is NWind_CHS.mdb under the Data directory in the source code project. In the open report data source dialog box, select the "provider" tab, click the establish connection button to open the "data Link Properties" dialog box, and select the "Microsoft Jet 4.0 OLE DB Provider" data provider. Click the "next" button to switch to the "connections" tab. Click "…" Click the button to locate the NWind_CHS.mdb file, and then click the OK button to complete the creation of the data source.

After returning to the "OLE DB" tab, enter the SQL statement in the query area:

SELECT

DATEPART ("yyyy", order. Order date)

AS

Order year, DATEPART ("m"), order. Order date)

AS

Order month, category. Category name, category. Description, product. Product name, order details. Quantity, order details. Unit price, order details. Discount

FROM

(order

INNERJOIN

Order details

ON

Order. Order ID = order details. Order ID)

INNERJOIN

Product

ON

Details of the order. Product ID = product. Product ID)

INNERJOIN

Category

ON

Product。 Category ID = category. Category ID

WHERE

DATEDIFF ("yyyy", order. Order date, '2012-01-01') = 0

ORDERBY

DATEPART ("yyyy", order. Order date), DATEPART ("m", order. Order date), category. Category ID, order details. Product ID

3. Design the report interface

3.1. Right-click in the report design interface and select insert-> Group header / Group tail. In this report, you need to insert a three-level grouping, and then set the following properties:

GroupHeader1DataField= ordering month

GroupKeepTogether=FirstDetail

RepeatStyle=OnPagegroupHeader2DataField= category name

GroupKeepTogether=FirstDetail

RepeatStyle=OnPagegroupHeader3DataField= product name

GroupKeepTogether=FirstDetail

RepeatStyle=OnPage

3.2. Add the following code to the report background code to set up the report directory:

Privatevoid groupHeader1_Format (object sender, EventArgs e) {this.groupHeader1.AddBookmark (txt ordering month 1.Text);}

Privatevoid groupHeader2_Format (object sender, EventArgs e) {this.groupHeader2.AddBookmark (txt ordering month 1.Text + "\\" + txt category 1.Text);}

After reading the above, have you mastered how to analyze the document directory of interactive reports in ActiveReports? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Tags: Reports orders categories products details data catalogs dates documents names buttons data sources files code selection interactive analysis content areas dialog boxes Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno vpn NVidia Shulou Tech Info Shulou Technology