This is an old revision of the document!
Calculated Fields
Calculated fields in a report are used to perform operations on existing columns so that the “calculation” does not need to be done in the SQL selection code. “Calculations” can be done on numbers, dates, and text.
The following chart shows the functions that are currently available. Users familiar with SQL will recognize the format of most of the operators and functions.
| Area | Type | Action | Notes |
| Operators | Arithmetic | Negate (Subtract) | |
| | | Add | |
| | | Multiply | |
| | | Divide | |
| | String | Concatenate | Add multiple text values together in a single string (see Calculated Field Notes) |
| | | | |
| Functions | Arithmetic | Exponentiate | Calculate a new value using an exponent against a given number |
| | | Modulus | Determine remainder from division operation |
| | Date/Time | Current DateTime | Calculate the current date & time |
| | | Current Date | Calculate the current date |
| | | Current Time | Calculate the current time |
| | Math | Round | Round a given number |
| | | Absolute Value | Use the absolute value of a given number (always positive) |
| | | Square Root | Calculate the square root of a given number |
| | | Pi | Use the value of Pi (to six decimals) |
| | String | Right | Return n characters of a text string beginning with the last character and counting to the left |
| | | Trim Left | Remove any blank spaces from the left end of text string |
| | | Trim Right | Remove any blank spaces from the right end of text string |
| | | Substring | Return n characters from a text string beginning at a specified position |
| | | Length | Return then number of characters in a given text string |
| | | Left | Return n characters of a text string beginning with the first character and counting to the right |
| | | Uppercase | Return a text string in all UPPERCASE characters |
| | | | |
Note 1: Enclose literal values in single quotes. Database values are enclosed in double quotes.
To Begin
Step to the “Display” tab of the report wizard.
Add a Calculated Field
Click the [Add Calculated] button in the lower right corner of the page.
The “Calculated Field” tool is displayed.
Update (Modify) a Calculated Field
Click on the row an existing calculated value.
The row is highlighted to indicate it is active.
Click the [Update Calculated] button in the lower right corner of the page.
The “Calculated Field” tool is displayed.
Remove a Calculated Field
Click on the red X at the right end of the row for an existing calculated value.
The row is removed from the field display list.
The Calculated Field tool has five areas provides a list of available values that can be used in calculations.
Name and data type information
Values (fields) available for use in calculations
Operators and functions available for use in calculations
Use the drop-down list to access Functions
Formula entry area
Action buttons
Enter a Calculated Field Name.
This is a required value and should be unique in the current report
Data Type will be determined by the application in a later step. Do not enter a value manually.
Use the Fields and Operators/Functions to add elements to the Formula area.
Select the desired element and click [Insert Field] or [Insert Function] as needed. The element is displayed in the “Formula” area.
Add all needed fields and operators/functions to build the formula.
Click [Validate] to confirm that the formula is valid.
A message is displayed to confirm if the formula is valid or not.
If the formula is valid, the “Data Type” value is automatically populated with the appropriate value.
Click [Save] to save the formula and close the “Calculated Field” tool.
Click [Close] to close with “Calculated Field” tool without saving any changes.
Calculated Field Notes
Formulas can be entered manually. The selection process described above is not mandatory.
Formulas can only reference values provided from the data selection. A formula cannot reference another calculated field.
Parentheses can be manually added in a formula to control the calculation order if necessary.
Example: “BALANCE” * (10 + 3) will give a different result than “BALANCE” * 10 + 3.
Concatenation can only be used on text strings. Text and numbers cannot be mixed.
Non-field text values must be enclosed in single quotes.
Example: Assume we want to concatenate “CARDNAME” and “CARDCODE” so that the resulting value is CARDNAME (CARDCODE) or Third Wave (C10000). The formula would look like: CARDNAME + '(' + CARDCODE + ')' where the parentheses are static values and so are enclosed in single quotes.
A calculated field can be used to create a column used for an Action link. The “formula” can simply be a text string (enclosed in single quotes).
Example: the “formula” is 'Click for PDF'. “Click for PDF” will appear in each row and serve as the link point for an Action link.