I. Overview
1) Parameter is a type of variable and the value is determined by users. The values of parameters are used to filter report data (if used with filters). In FineReport, you can bind a parameter with a widget on the parameter pane. In this way, during the preview, report users can utilize the widgets to define parameter values and filter data; and this process is called parameter query.
2) Global parameter: It can be used by all templates in the same report project.
3) Template parameter: It can only be used by current template. If multiple templates have parameters with the same name , the parameter values will not affect each other.
4) In a template, if there exists a template parameter that shares the same name with a global parameter, the system only recognizes the template parameter.
You will learn |
---|
|
II. Define global parameters
1. Click [Server] > [Global Parameters]
2. Click [+] to add a global parameter, with the default name [p1]
The default type is [String].
3. Double click [p1] to modify the name to area
4. Set the default value to East China and click [OK]
5. Click the pen icon to edit the parameter pane
6. A hint appears at the upper right corner, stating that the parameter [area] has not been bound with widgets on the parameter pane
7. Create a new normal report
1) Click the pen icon to edit the parameter pane.
2) A hint also appears at the upper right corner, stating that the parameter [area] has not been bound with widgets on the parameter pane. In other words, two template files can share [area].
8. Click the pen icon to edit the report area
9. Click B2 and insert a formula
1) Find Global Parameters in the list of Variables and double click $area. Click [OK].
2) Preview to view the value of [area].
III. Define template parameters
1. Click [Template] > [Template Parameter]
2. Click [+] to add a global parameter, with the default name [p1]
The default type is [String].
3. Double click [p1] to modify the name to area
4. Set the default value to North China and click [OK]
5. Click the pen icon to edit the parameter pane
6. A hint appears at the upper right corner, stating that the parameter [area] has not been bound with widgets on the parameter pane
7. Click the pen icon to edit the report area
8. Click B2 and insert a formula.
1) Find Template Parameter in the list of Variables and double click $area. Click [OK].
2) Preview to view the value of [area].
3) If a template parameter and a global parameter share the name, then the template parameter overrides the global parameter.