Custom Calculation
Insert a custom calculation into your report to display dynamic values based on formulas or expressions that you define.
When to use custom calculation
- Displaying calculated metrics: Show calculated values such as percentages, sums, or ratios alongside your report data.
- Highlighting key results: Display important computed values directly in your report for quick reference.
Add a custom calculation
- In the Toolbar panel on the right, select Edit Report.
- Select the Report Widgets icon.
- Drag the Custom Calculation control onto the report. A yellow highlight appears to show possible placement areas. The Custom Calculation panel appears at the same time.
- Complete the necessary fields for your calculation.
- Select the Design tab and expand Report Section Properties.
- Adjust the Properties, Font, and Border as needed.
- Click Exit Edit Mode when finished.
Design properties
Properties
| Property | Description |
|---|---|
| Description | Enter a label that describes the calculation’s purpose. |
| Height | Set the height of the control in pixels. |
| Background Color | Select a background color for the control. Use the color picker and select Apply, or enter a HEX code manually. |
| Top Margin | Adjust spacing between the control and elements above it. |
Font
| Property | Description |
|---|---|
| Font | Choose a font family for the calculation text. |
| Size | Set the font size. |
| Font Color | Select a color for the calculation text. Use the color picker and select Apply, or enter a HEX code manually. |
| Style | Apply font styles such as italic, bold, or underline. |
Border
| Property | Description |
|---|---|
| Vertical Border | Show or hide vertical borders for the control. |
| Horizontal Border | Show or hide horizontal borders for the control. |
| Vertical Thickness | Set the thickness of the vertical border. |
| Horizontal Thickness | Set the thickness of the horizontal border. |
| Border Color | Select the color for the borders. Use the color picker and select Apply, or enter a HEX code manually. |
Edit the fields
Change the format
- Select the Data tab and expand Data Configuration.
- Click the pencil icon next to Edit Fields to open the dialog.
- In the Fields column, select the field you want to format.
- Expand the Format section.
- Choose your format options, such as data type, category, and formatting options.
- Select Validate to check your changes, then select Save.
Build a custom formula
- Select the Data tab and expand Data Configuration.
- Click the pencil icon next to Edit Fields to open the dialog.
- In the Fields column, select the field you want to edit.
- Expand the Script section.
- In the left column, select a field to display its available values in the Field Name box.
- Double-click any value or field in the Field Name box to insert it into your formula.
- Use the operator buttons to add mathematical or logical operators to your formula.
Every formula must start withresult=and end with a semicolon (;). - Select Validate to check your script, then select Save when finished.
Edit Fields options
Format
- Data Type: Specifies the kind of value in the field.
- Alignment: Sets the text alignment within the field.
- Category: Determines the data display style, with options depending on the data type.
- Options: Additional controls that refine your chosen category.
| Data Type | Category | Option |
|---|---|---|
| Char | Text fields used for names, codes, or descriptions.
| N/A |
| Numeric | Decimal fields used for quantities, financial values, or measurements.
|
|
| Integer | Whole number fields used for counts or identifiers.
|
|
| Date | Calendar date fields.
|
|
| Time | Time fields representing hours, minutes, or seconds.
|
|
| DateTime | Fields that store combined date and time values.
|
|
Script
| Element | Description |
|---|---|
| Left column | Lists all available fields and calculations. |
| Field Name | Displays field names or values related to your selection. |
| Script area | Provides a place where you compose your formula. All scripts must begin with result= and end with a semicolon (;). |
| Operator buttons | Adds operators (=, +, -, *, /, ;) to the formula. |