Use FineReport making main report and subreport

main report and subreport

As shown in the figure is a fill tables, divided into two parts, the upper part of the main table for the order, the lower half is divided into order details, some of the data were from two different physical form, after the user modifies the data, while preserving to two physical table and maintain a database transaction consistency.

Here we look at the process of achieving the above statements with FineReport reporting tools.

1.frDemo Connect to the databasefrDemo

2.Design Reports

2.1 New Report

2.2 template design
The basic framework of the following diagram design good report.

template design

2.3 Create a data set

New Dataset ds1:
SQL statement:select * from Order Details

New Database ds2:
SQL statementselect * from order where order ID=10248

2.4 Binding Data Columns

 Binding Data Columns

Follow these forms will be dragged into the field data sets corresponding statements within the cell, and make the appropriate settings.

Bidding Data Column Content Basic property Setting
B3 ds2.order ID from top to bottom extension, the rest of the default
D3 ds2.Ship date extended from top to bottom,the rest of the default
F3 ds2.Arrival date extended from top to bottom,the rest of the default
B4 ds2.Customer ID extended from top to bottom,the rest of the default
F4 ds2. ShipName extend from top to bottom,the rest of the default
B5 ds2.Shippers extend from top to bottom,the rest of the default
D5 ds2.Freight extend from top to bottom,the rest of the default
F5 ds2.Consignors city extend from top to bottom,the rest of the default
A8 =&B8  
B8 ds1.Product ID extend from top to bottom,the rest of the default
C8 ds1.Price extend from top to bottom,the rest of the default
D8 ds1.Discounts extend from top to bottom,the rest of the default
E8 ds1.Quantity extend from top to bottom,the rest of the default
F8 =C8*E8  

2.5 Cell set filters
Double-click the B8, enter the cell data Columns dialog box, click on the filter, set the filter conditions: Order ID equal to B3.

Cell filtering

2.6 Setting form properties of the cell
On B3, D3, F3, B4, F4, B5, D5, F5, A8, B8, C8, D8, E8, F8 cell setting form properties, including D3, F3 is the date type, C8, D8, E8 are digital type, and allows decimals, the rest are text type.

2.7 Furnished property is set to report
Open Report | Report Properties dialog box to fill, as shown:

Report Properties

Click the Add button in the upper left corner to add a new built-in SQL. 。

Database selection frDemo,mode selection order is empty,select table order,as shown:

add built-in SQL

Click the Add Field intelligent,dialog box shown below appears, for the template to be filled in the fields and the corresponding data fields in the table, you can freely select the corresponding fields required.

Add Field intelligent

After the addition, clickSmart add a cell fill in the corresponding cell. When you can choose not to participate in the cell does not change the update,which can accelerate the speed of data after completing the update. Add After clicking OK,to display the following chart,you can see has been automatically generated SQL statement to update the database corresponding to the preview.

Smart add a cell

Add a built-in SQL2, database selection frDemo, mode is empty, select the Order Details table. In the same way smart add fields à intelligent add a cell, set up after as shown

Smart add sql2

3.Save Preview

save as
%FineReport_HOME%/WebReport/WEB-INF/reportlets/com/doc/form/9.2.cpt

Start the Report Server, click on the top right corner of the designer furnished preview, you can preview it fill up. Or direct data in the browser address:
http://localhost:8075/WebReport/ReportServer?reportlet=com/doc/form/9.2.cpt&op=write

Copyright©2017 Fanruan Software Co.,Ltd. All Rights Reserved.

TOP