Introduction to rdlc reports integrated in OEA framework

Source: Internet
Author: User

Previously, OEA had been using a report developed by Delphi, so I had been trying to build a pure one in OEA for two years. NET Report Module, but the thought of developing a complex report engine and designer is troublesome. This is why it has been dragging on. Recently, I started to study some mature report engines. After comparison, I found that Microsoft rldc reports can meet most of my requirements. These include complex controls such as tables, matrices, and charts. The same report format can also be used directly in B/S mode. The latest tablix control is very flexible and can implement most Table Styles. So I decided not to create a wheel in time and effort, but to integrate Microsoft rdlc reports directly. It took less than a week to integrate it into OEA. Although it is still in the first version, there is no designer for the customer. However, in terms of the current development efficiency, it is faster for developers to develop a report.

 

Next, I will demonstrate how to develop a report module based on the OEA framework based on the released example project (jxc.

 

Report development example

 

Step 1, We need to develop a general list module.

In this way, you can set the entities and data layers related to background data before using reports.CodeDevelopment is complete, and check whether the data is correct. This part of content has nothing to do with the report. I will directly use the purchase warehouse receiving ticket interface in the document query module before jxc:

Copy the code of this tab to a new tab,

In the red line, the Code directly copies the previous line and modifies the display name. The effect is as follows:

Now, you have completed the development of a new list query result interface. So how can we convert this traditional list interface into a report display interface?

 

 

Step 2In the aggregate BLOCK statement, this interface BLOCK statement is a report interface block. The Code is as follows:

  New   surrounderblock   (  typeof   (  orderstorageinbill  ),   queryobjectview  . resultsurroundertype) {keylabel =  " purchase warehouse receiving ticket-Report " , blocktype =   blocktype  . report }, 

ThenOrderstorageinbillIn this view configuration corresponding to the class, declare the name of the report to be used (the name must be unique among all reports in the system ). As follows:

 
Internal classOrderstorageinbillconfig:Entityconfig<Orderstorageinbill> {Protected override voidConfigview () {view. usereport ("Procurement warehouse receiving ticket report statistics. rdlc");

Open the interface again and we will find that the corresponding interface block of this tab has become a report interface, with two important functions of the report interface at the same time: refresh the rdlc field and report data ".

Here,All code has been completedThe following process does not need to be closed.ProgramOr re-compile.

 

Step 3You can design the report.

Note that since the rdlc report file has not been created and designed yet, all the buttons in the report display control are unavailable. Click "Refresh rdlc field" to bring up the following interface:

After you click OK, the Framework automatically generates the relevant rdlc file to the specified directory (this directory can be configured in the configuration file), refresh the report display control, and the following prompt is displayed:

Click OK to copy the path to the clipboard.

Note that the button of the report control is available, indicating that the corresponding rdlc file has been generated:

So we need to use the designer to design it. As there is no separate rdlc designer yet, vs2012 is used for the moment. Open the file directly in vs (the path is already in the clipboard). vs starts the corresponding report design interface:

When the framework generates this file, it automatically generates the relevant data source node (in this example, there is only one simple physical data source, and more data sources can be set using code ), in addition, the names of these fields contain the Chinese names displayed on the interface to facilitate report design.

Therefore, we only need to design the report for the data. How to Design the content of the rdlc report is as follows:

As mentioned earlier, the program does not need to be closed during the design process. After modifying and saving the rdlc file, you can click the refresh button on the report control to preview the current effect. This is the final report page:

In addition, you can click the "report data" button to view the list data displayed behind the current report to help you understand the background data.

 

 

In the future, I may need to find a rdlc designer to facilitate the customer's use. This is also a headache ......

However, it has been two years since the integrated report was completed. Now we can develop the report more quickly in OEA. Congratulations!

 

 

Appendix: rdlc Data Binding Type Definition

 

Supplement: No vs2012 computer installed, need to install http://www.microsoft.com/en-us/download/details.aspx? Id = 27230
After the reportviewer control, you can view the report. It is not possible to copy the DLL directly to the DEBUG directory. Who knows why?

 

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.