Working with Formula Fields
Formulas are calculated from DBFields, other formulas, summaries, and parameters. This topic introduces how you can insert formula fields in a report and add conditional formats to the formula fields.
For the formula fields in a report, you can use them as the trigger object of links, and change their display types if you want.
This topic contains the following sections:
See an example: The SampleComponents catalog, included with Designer, contains reports that have examples of how you could use each component type in a report. For the formula field example, open <install_root>\Demo\Reports\SampleComponents\UsingFormula.cls
.
Inserting Formula Fields in a Report
You can insert formula fields in the report areas listed in Component Placement.
- For a business view-based report
Select the formula from the Dynamic Resources > Formulas node in the Data panel and drag it to the destination. - For a query-based report
You have two ways to insert a formula into a query-based report.- By dragging and dropping
Select the formula from the Formulas node in the Data panel, then drag it to the destination. If the given formulas are not what you want, select the <New Formula...> item to create one as required. - Using dialog box
- Position the mouse pointer at the destination where you want to insert the formula.
- Select Insert > Formula or Home > Insert > Formula. Designer displays the Insert Fields dialog box.
- Select the required formula from the Formulas node. You can select multiple formulas to insert them all a time.
- If you select multiple formulas, in the Insert Layout box, specify the layout of the formula fields in the report. By default, Designer arranges them in the default layout. You can arrange the formula fields horizontally or vertically by selecting Horizontal or Vertical, and customize the space between them.
- Select the Insert button to insert the formula fields into the destination.
- By dragging and dropping
- In a query-based report, not all formulas in the catalog are valid in the current context, so under the Formulas node in the Insert Fields dialog box or the Data panel, Designer only lists the valid formulas that are based on DBFields from the current dataset.
- If you insert a formula into the detail panel of a data component, Designer automatically inserts its name as a label into the corresponding header panel; otherwise, Designer places the formula and its name label in the same panel. If you do not want Designer to insert the name label automatically, you can clear Insert field name label with field in the Options dialog box (File > Options > Component > Insert field name label with field).
Adding Conditional Formats to Formula Fields
You can add conditional formats to formula fields in a report, then when a specified condition is fulfilled, Logi Report automatically applies the format defined on the condition to the field values. This is very useful to highlight values that the report users may need to act on at runtime.
To add conditional format to a formula field, right-click it and select Conditional Formatting from the shortcut menu, then take the same procedure as described in Adding Conditional Formats to DBFields.