Files are often used as report data sources, which can be well supported by collecting computing reports. An example is provided below.
Report description
The data file is the stock price information of each month (one file per month, named as "stock_record_yyyymm", for example, stock_record_200901.txt1_stock_record_200902.txt ...), The report parameters include the stock code, trading date, and closing price of each stock. The report parameters are the start year and end year. You need to query the maximum number of consecutive days for each stock to rise in this period, and set the maximum number of consecutive days to record the day's date and closing price.
The report format is as follows:
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/42/40/wKiom1PXMVuTfrR3AADlujf9dVw081.jpg "style =" float: none; "Title =" esproc_report_file_performance_0000.jpg "alt =" wkiom1pxmvutfrr3aadlujf9dvw081.jpg "/>
Steps
Write scripts
First, use the set calculator to complete file reading and data computing, and write a script (stocks. DFX ).
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/42/41/wKioL1PXMnfgrfH9AAD2SGSpbhY845.jpg "Title =" esproc_report_file_cece_2.jpg "style =" float: none; "alt =" wkiol1pxmnfgrfh9aad2sgspbhy845.jpg "/>
A1 calculates the sequence of months involved by passing in the start and end months parameter, that is, the files to be used;
A2 reads all the file data that needs to be used in this time range through the import loop;
A3 use derive to add the field ballooningnum for the sequence table;
A4 and A5 are sorted by stock code and transaction date and grouped by stock code;
A6 determines in the cycle whether it is higher than the closing price of the previous trading day, and calculates the consecutive days of increase for each stock in each trading day;
A7 uses Pmax to specify the maximum number of consecutive days for each stock increase, including the day and closing price for the maximum number of consecutive days for each stock increase, which are sorted in descending order by ballooningnum.
Create report
Open the computing report designer, select File-new report from the menu bar, and click Generate blank report to create a blank report.
Set parameters
Select Report-parameters in the menu bar, and add two query parameters begin and end. The type is an integer.
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/42/40/wKiom1PXMV6Q3x-nAACsrJuc4lI360.jpg "Title =" esproc_report_file_cece_3.jpg "style =" float: none; "alt =" wKiom1PXMV6Q3x-nAACsrJuc4lI360.jpg "/>
Set Dataset
On the menu bar, select Report-dataset, set the dataset type to "set calculator", select the DFX file in the displayed dataset settings window, and set input parameters, that is, two parameters of the report, begin and end, are used to create the dataset ds1.
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/42/41/wKioL1PXMnuyvz11AAEDolD17nk876.jpg "Title =" esproc_report_file_cece_4.jpg "style =" float: none; "alt =" wkiol1pxmnuyvz11aaedold17nk876.jpg "/>
The DFX file path can be set to an absolute path or a relative path. The relative path in the designer is relative to the Application resource path configured in the tool-> option, on the web end, it is relative to reportconfig. the reportfilehome path in XML.
Edit a report template and Expression
In the newly created report template, set the report style and expression, the first behavior report header, and the second behavior report expression.
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/42/41/wKioL1PXMnzhz-BUAABsp9EfGJw775.jpg "Title =" esproc_report_file_cece_5.jpg "style =" float: none; "alt =" wKioL1PXMnzhz-BUAABsp9EfGJw775.jpg "/>
A2: Use the select function to retrieve the stock encoding list based on the dataset ds1
B2-D2: According to A2 extension, through the value expression respectively obtain the corresponding trading date, closing price, maximum rising days of each stock.
Show reports
In the report designer, select preview report in the toolbar to view the report Presentation results in the designer.
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/42/40/wKiom1PXMWTjQoqJAAFOMZwrdCg101.jpg "Title =" esproc_report_file_cece_6.jpg "style =" float: none; "alt =" wkiom1pxmwtjqoqjaafomzwrdcg101.jpg "/>
Designer preview Effect
In addition, the dataset report designer has built-in tomcat, which allows you to publish a report to the Web end to view the page effect. Click the IE icon in the upper-right corner of the toolbar, set the main directory of the report and the main directory of DFX (default can be used) to publish the report.
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/42/40/wKiom1PXMWXDJT9HAACKVsIMYQw473.jpg "Title =" esproc_report_file_cece_7.jpg "style =" float: none; "alt =" wkiom1pxmwxdjt9haackvsimyqw473.jpg "/>
Preview after page publishing