Formula Editor
With the Formula Editor you can use the powerful formula syntaxes to create and/or modify formula fields or property formulas for a dynamic report. You can use all report fields (database, parameter, other formula fields etc.), a lot of predefined functions, constants and operators and last but not least your own user defined functions in your formula to meet your requirements.
The dialog is divided into the following three main components.
Navigation
If the report contains a formula field, SQL expression field, user defined function or a record- or group selection formula then it is displayed in the navigator on the left side of the dialog. The navigator enables you to create new formulas, SQL expression fields, user functions, to rename, edit and delete existing ones. Changing the current selection in the navigator will save the changes on the current formula, SQL expression field, or user function and switch to the new selection to edit its content. This enables you to work on different formulas to edit, rename and delete them without closing the formula editor.
Once a formula, function, SQL expression field is selected in the navigator, the editor, property panel, and syntax explorer will change it's content to the selected element/formula.
The navigator as well shows the structure of the report with all property formulas. Please note that these formulas can only be edited here. To create or delete such formula, please open the properties editor of the element. Any node in the property formulas tree that is displayed in gray is a report element, only black nodes represent a formula.
Editor
In the text editor element of the formula editor you can enter or edit the currently selected formula. You can add fields, functions and operators using drag and drop from the element selection on the right side of the dialog to the formula. To make it easier to edit the formulas the different syntax elements are displayed in separate colors.
The following keyboard shortcuts are available:
-
F1 will open up the context help page for the selected function or operator, if there is such a help page available.
-
F2 will select the name of the formula in the navigator so that you can rename it.
-
F3 will open up a small dialog for checking which formulas reference the selected variable or will open up the selected formula field in the formula editor.
-
Ctrl+Shift+L disables or enables the line numbers on the left side of the editor.
-
Ctrl+L opens a dialog where you can enter the line number to jump to.
-
Ctrl+N creates a new formula.
-
Alt+Shift+O toggles the mark occurrences option.
-
Ctrl+7 toggles the line comment.
-
Ctrl+T search a text in all formula fields
-
Ctrl+Space is the shortcut to call the code completion. If you want to use for example the function "maximum" you can enter "max" and press the Ctrl+Space keys. This will bring up a popup list with all available suggestions starting with "max". To complete the function you wanted to type, you can choose it from the list using up and down key and confirm it with the "Enter" key. It is also possible to reduce the number of suggestion by typing more letters of the desired word. The code completion can also be used to complete constants, operators, field names (e.g. name of a formula or parameter field). If the code completion was called for a word, which only has one possible completion, it will complete the word instead of showing the popup.
In the tab "Problems" you can see the state of the formula. If the formula contains an error or warning then it will be displayed in this tab.
Besides changing the formula name you can select the used formula syntax in the tab "Properties". Currently there are two languages available for formulas: (Visual) Basic Syntax and Crystal Syntax. The second combo box enables you to define, how i-net Clear Reports should treat empty database fields in formulas. The property "Value Type" displays the return type of this formula. This is determined automatically.
The tab "Help" will always display the help content for the currently selected syntax element in the current formula. This works for all keywords known to the Designer, like function, constants or operators. Use this tab if you're not sure about the parameters or result of a function or operator.
With the "Debug" tab you can test the current formula right in the design environment of the Formula Editor. The debug panel allows you to set all input parameters and variables of a formula, run it an view the result. This is a powerful feature to track down issues with formulas. For detailed description of the feature, please refer to the Formula Debugger page.
Element selection
The formula element selection trees on the right side of the dialog contains lists of all available field elements, functions, operators, constants, and syntax elements in the selected formula language. These includes user functions, user defined functions and proposals for the property formulas. The list is divided into four separate trees: report field elements, functions, operators, and constants. For additional information about a function, operator or constant item, hold the cursor over this element. The tool tip will provide detailed information such as parameter description and information about the return type of the function. Select a tree node and press F1 for a more detailed description including examples. You can use the instant search (search as you type), to find a formula element by name or parameters. Use double click or press "Enter" to insert the selected formula element at the cursor position or use drag and drop to insert the formula element into the formula.
To save the formula(s) click on the "Ok" button. Click "Cancel" to close the dialog and undo all modifications since the last click on "Apply".