### Formula Editor dialog

This dialog appears when you expand the Dynamic Resource > Formulas node in the Resources panel of Web Report Studio or the Resources box of the Web Report Wizard, then click <Add Formula…>, right-click a dynamic formula and select Edit from the shortcut menu, or click in the value cell and select <Edit Expression> or <Create Formula> from the value drop-down list when setting property values in the Inspector panel. It helps you to create or edit a dynamic formula in a web report, or create an expression to control the value of the specified property. See the dialog.

Formula Name

Specifies the name of the formula. Disabled when creating an expression.

Use As

Specifies to use the formula as one of the following types: Group, Detail, or Aggregation. Disabled when creating an expression.

Which type a dynamic formula can be used as depends on the following:

- Any formula can be used as Detail.
- Record level pass 1 formula can be used as Group.
- Comparable and record level pass 1 formula can be used as Group.
- Group level formula can be used as Aggregation.

Fields box

Displays a list of those fields that are available to formulas. The fields include the group and detail objects in the current business view, and the dynamic formulas that have been created in the report. You can select one field and double-click it to insert the field into the editing box at the insertion point.

Functions box

Displays a list of JReport functions that are available to formulas. When you select one function and double-click it, JReport will insert the selected function into the editing box at the insertion point completely with its required syntax items (parentheses, commas, and so on).

For details about usage of the functions, refer to Built-in functions.

Operators box

Displays a list of operators that are available to formulas. Select one operator and double-click it to insert the selected operator into the editing box at the insertion point.

For details about usage of the operators, refer to Operators.

Editing box

In this box, you can build and edit your formula. There are several ways to work with formulas:

- Select formula components from the Fields, Functions and Operators boxes in the Formula Editor, and then double-click the components, JReport will then insert them in the formula;
- Type your formula in the editing box directly;
- Use the above two methods together;
- Paste formula text from the text document of other programs.

Note: 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".

Tests the syntax of your formula. If the syntax is incorrect, JReport provides an opportunity to correct the errors.

Selects a general operator to be used in the editing box.

A color palette is provided for you to insert the HEX code of a color simply by clicking the corresponding color in the color palette instead of inputting the HEX code manually.

OK

Creates or edits the formula and closes the dialog.

Cancel

Cancels the creation or edition of the formula and closes the dialog.

Displays the help document about this feature.

Ignores the setting and closes this dialog.

###### Related topics:

- Using dynamic resources