
Creating a formula
To create a formula in catalog, follow the steps below:
- In JReport Designer, open the catalog to which you want to add the formula.
- In the Data tab of the Catalog Browser, expand the data source in which to create the formula, then right-click the Formulas node, and then select Add Formula from the shortcut menu.
- Enter a name for the formula in the Input Formula Name dialog and click OK. The Formula Editor window will then be displayed. See the window.
- Compose the formula by selecting the required fields, functions and operators from the Fields, Functions and Operators panels. You can also write the formula by yourself in the editing panel.
- To comment a line, click the Comment/Uncomment button
on the toolbar.
- If you want to bookmark a line so that it can be searched easily later, click the Bookmark button
.
- Click the Check button
to check whether or not the syntax of your formula is correct.
- When done, click the OK button to add the formula.
See also Formula Editor window for detailed explanations about options in the window.
Notes:
- You should have some knowledge of the formula syntax before you can successfully compose a formula with no errors. To learn the formula syntax, refer to topics in Formula syntax.
- If you refer to any field in the formula, the reference name for that field will be prefixed with an @ sign. If the field name contains spaces, the reference name in formula will be quoted with double-quotation marks (""). For example, if the field name is Customer Name, then the reference name will be @"Customer Name".
- In the Fields panel, if the summaries or parameters you want to use have not been predefined in the catalog, you can create them by your own by clicking the New Summary button
or the New Parameter button
on the toolbar (for details, see Creating a summary and Creating a parameter).
