In addition to the data source sorting function, ActiveReports also provides the end user sorting function. The end user can sort reports in a region and the entire data source, combined with data drilling and filtering, you can easily analyze report data.
1. Create a report file
Create an application named rptProductListForSort. the ActiveReports report file of rdlx uses the ActiveReports page report as the project template. After the report is created, select convert to continuous page layout (CPL) Report from the report menu items of, converts a fixed-page report to a continuous report.
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 |
3. Add a dataset
Right-click the new NWind_CHS data source and choose add dataset menu item.
General-Name: Products
Query-query:
SELECT
Product. *, category. category name, category. Description
FROM
Product
INNERJOIN
Category
ON
Product. Category ID = category. Category ID
ORDERBY
Category. Category ID;
4. design the report page
From the Visual Studio toolbox, add the Table control to the report design interface, and drag the fields in the Products dataset to the corresponding columns of the Table. The design interface is as follows:
650) this. width = 650; "width =" 644 "height =" 275 "title =" ActiveReports report function display page report "style =" border-width: 0px; display: inline; "alt =" ActiveReports report function display page report "src =" http://www.bkjia.com/uploads/allimg/131228/20444R120-0.png "border =" 0 "/>
5. Add a dynamic sorting function for the column header Cells
Select the column header cell, and click the Properties dialog box in the Command Area of the Properties dialog box to open the properties Setting dialog box of the text box, and set the following attributes on the interactive sorting page:
| Product Name column: |
Add the interactive sorting function to the text box: True Sort expression: = [product name] Data area or group sorting: select a data area or group, tablew.group1 Ranking expression in this range: current range |
| Unit quantity column: |
Add the interactive sorting function to the text box: True Sort expression: = [unit quantity] Data area or group sorting: select a data area or group, tablew.group1 Ranking expression in this range: current range |
| Unit Price column: |
Add the interactive sorting function to the text box: True Sort expression: = [unit price] Data area or group sorting: select a data area or group, tablew.group1 Ranking expression in this range: current range |
| Inventory column: |
Add the interactive sorting function to the text box: True Sort expression: = [inventory] Data area or group sorting: select a data area or group, tablew.group1 Ranking expression in this range: current range |
| Order Quantity column: |
Add the interactive sorting function to the text box: True Sort expression: = [order quantity] Data area or group sorting: select a data area or group, tablew.group1 Ranking expression in this range: current range |
| Order Quantity column: |
Add the interactive sorting function to the text box: True Sort expression: = [reorder quantity] Data area or group sorting: select a data area or group, tablew.group1 Ranking expression in this range: current range |
6. Run the program
Run the program with the F5 key. There is a Sort chart on the right of each column header. Click the sort chart to sort the data:
650) this. width = 650; "width =" 644 "height =" 454 "title =" ActiveReports report function display Dynamic sorting "style =" border-width: 0px; display: inline; "alt =" ActiveReports report function show dynamic sorting "src =" http://www.bkjia.com/uploads/allimg/131228/20444Q0B-1.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-width: 0px; display: inline; "alt =" ActiveReports report function display "src =" http://www.bkjia.com/uploads/allimg/131228/20444VM6-2.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/1255846