The core of traditional report development articles is about how to set report formats, titles, fields, and how to obtain data. This is just an introduction to report design. This article does not discuss it here. This article only describes how to design reports in batches-Cross report templates.
Traditionally, it seems reasonable to design a report file when developing each report. However, in actual development, this approach is extremely laborious (500 words are omitted later), and I do not want to do this anyway.
This method is also taught by my colleagues. You can use cross-Report to simplify the report design steps:
Take crystal report as an example (Jasper for Java)
(1) pre-defined cross-Report Templates for Crystal Reports. For example:
Cross_1x1.rpt
Cross_2x1.rpt
Cross_3x1.rpt
Cross_2x2.rpt
....
(2) The Field names of these report templates are written to death, for example:
Column1
Column2
Column3
Column4
Column5
...
Value
(3) Use the push mode to provide data for reports
Use code to obtain data (note that the fields in the report template are the same), and then push the data to the Crystal Report for display.
(I personally think that the PULL mode is quite messy. This method writes the data acquisition steps into the report file, which is quite inflexible in practical applications)
Effect:
(1) data as follows:
Column1 column2 Value
Ryan phone 1000
Ryan broadband 2000
Wenzhou phone 3000
Wenzhou broadband 4000
...
(2) Use the cross Report Template cross_1x1.rpt to display the following results:
Total telephone bandwidth
Ryan 1000 2000 3000
Wenzhou 3000 4000 7000
Total 4000 6000 10000
Therefore, the work of report developers can be simplified:
(1) Set Report conditions: This step can also be automatically generated using the configuration file.
(2) Obtain report data: obtain data based on the conditions set by the passing user
(3) specify a Report Template
In this way, developers can focus on getting data without dealing with the UI, which greatly improves the efficiency of report design, which is quite convenient in actual work.