Overview
Version
FineReport Version | Functional Change |
---|---|
11.0 | - |
11.0.1 | Added the Input Tip and Check Before Closing options in the formula editing box. Optimized the Search function for formulas. |
11.0.3 | Added the auto-completion function: If only one option is available to complete the formula you are editing on the formula editing panel, you can remove the completion prompt, and then the formula can be completed automatically. For example, when you enter HO on the formula editing panel, the formula HOUR() is the only option to complete the formula. In this case, you can enter a character, delete the character, and enter an English letter, after which the editing formula will be completed as HOUR() automatically. |
11.0.4 | Allowed you to adjust the outermost layer size of the formula editing box. |
Function Description
When designing templates, you need to use the formula functions in many cases such as summing, counting, and making judgements. This document describes the calculation composition and calculation syntax of functions.
Calculation Syntax
Concept
Composition Elements | Syntax | Example |
---|---|---|
Function | SUM(contract amount), SUM(A1) | |
Data Column | Names of cells with data columns | A1 (black) |
Operator | +, -, *, / | |
Text expression | Numbers for numeric text String and date text in quotes true or false for boolean text null for null text | 2000 "large order" and "2020-07-15" true or false null |
Function Syntax
In FineReport, functions are the main part of calculations.
1. In FineReport calculations, functions are displayed in blue, each with a specific syntax.
For example, you can enter = in a cell of the template you create in FineReport, and then double-click the cell, after which the formula editing box will appear, as shown in the following figure.

1. Simulation calculations are not supported in the dataset function.
2. Remote simulation calculations are not supported in the report function.
Position | Description |
---|---|
A | Position to enter the formula ![]() |
B | Box to search the function Function and Parameter, two types of search results. Prefix f(x) for function items Prefix $ for parameter items |
C | Automatic recognition and display of entered formulas Parameters (including global variables, system variables, already defined global parameters, template parameters, and dataset parameters) and functions can be displayed. Prefix f(x) for function items Prefix $ for parameter items ![]() 1. Custom formulas are displayed in the same way as the formulas that come with the report. 2. Functions are prioritized over parameters in display position, so parameters are displayed after all related functions have been displayed. 3. Only one among the parameters with the same name can be displayed. |
D | Selecting the function type |
E | Selecting the needed function |
F | Selecting whether to reference a parameter |
G | Checking the use of formulas |
H | Checking the validity of formulas. For details, see section "Formula Checking." |
I | Checking before closing. For details, see section "Formula Checking." |
J | Simulation calculation. |
For details, see section "Result Viewing Based on the Simulation Calculation."
In V 11.0.4, you are allowed to adjust the outermost layer size of the formula editing box, as shown in the following figure.
2. Multiple functions can be used in the calculation. For example: IF(SIGN(A2)=1,B2,0)
Two functions, IF and SIGN, are involved in the calculation.
The above example is a case where one function is included (nested) in another. In this case, the SIGN function for cell A2 will be calculated before the IF function because the SIGN function is inside the parentheses.
Data Column Syntax
You can insert the data column into the calculation. The function syntax often shows where to insert the data column. For example: COUNT(value1,value2,...)
For example, if B2 is the salesperson data column, you can enter the formula =count(B2) in a cell to calculate the number of the salespersons, as shown in the following figure.
Operator Syntax
To create a calculation, you need to know the supported operators. Operators are in light black in FineReport calculations.
Text Expression Syntax
This section describes the correct syntax for text expressions in FineReport calculations.
Text expressions represent constant values essentially. When using functions, you may need to use text expressions to represent values like numbers, strings, and dates.
Example
The function calculation consists of four elements:
Content | Description | Display in the Report |
---|---|---|
Function | A statement used to transform a value or member in a field | Displayed in blue in the report designer |
Data Column | Data column in the data table | Displayed in black in the report designer |
Operator | A symbol that indicates calculation | Displayed in light black in the report designer |
Text expression | A constant value expressed in terms of what is written | In the report designer Text values and time values (in quotes) displayed in pink Numeric values displayed in purple |
Report Design
For example, create a dataset ds1 based on the built-in dataset Sales volume and make a judgment on the sales volume of each region.
Drag the Region field and the Sales volume field into cell A2 and cell B2, respectively, select Summary in Data Setting for the Sales volume field, and insert the formula into cell B2 to sum the sales volume of regions, as shown in the following figure.
Formula Input
Choose Cell Element > Insert Element > Insert Formula, and enter the formula if(B2>8000, "high volume","low volume") in the pop-up Formula Definition box to define the sales volume (If the sales volume is greater than 8000, it is defined as high volume, otherwise it is defined as low volume.), as shown in the following figure.
The following describes the entered calculation content :
Content | Description |
---|---|
Function | IF |
Data Column | B2 |
Operator | |
Text expression | String text: "high volume" and "low volume" Numeric text: 8000 |
Formula Checking
Two checking methods are available:
Method one: You can click Validity Check to check the formula, as shown in the following figure.
Method two:
You can select Check Before Closing, and click OK to check the formula. If the formula is correct, the formula editing box will be closed directly while if the formula is wrong, an error message will appear, as shown in the following figure.
Result Viewing Based on the Simulation Calculation
After the formula editing, you can click Simulation Calculation, and enter the data to be validated of the parameter B2. For example, enter 400, and you can view the calculation result low volume, as shown in the following figure.

1. The following functions are not supported in simulation calculations: dataset function, hierarchical coordinates function, GETUSERDEPARTMENTS() and GETUSERJOBTITLES() (used to retrieve departmental roles based on department and position), WEBIMAGE function, TOIMAGE function, file function, and treelayer function.
2. Remote simulation calculations are not supported in the report function.
3. Parameters that require expansion before calculation are not supported in simulation calculations.