Use Jasperreport to calculate openingbalance
When calculating the balance at the initial stage based on the access amount, cross-row calculation is required. The Jasper expression can be used, but the steps are complex and difficult. It is easy to use the set calculator to assist Jasper, the following is a simplified example.
Data.csv stores the fund access information for each period of an account. You need to calculate the initial balance based on the file. Some source data is as follows:
Code of the Set calculator:
A1: reads files using commas (,) as the delimiter.
A2: Calculate the initial balance and return the calculation result to the report. The initial value of the account is 43, and the calculation result of the last comma is returned, as follows:
The assembler provides a JDBC interface. The report tool recognizes the assembler as a common database.
The following uses Jasper to design the simplest list table. The template is as follows:
After previewing, you can see the report results:
The method of the report call set calculator is the same as that of the call stored procedure. For example, save this script as balance. dfx, you can use call balance () in the SQL designer of Jasper to call and pass in parameters.