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.
The Calculated Field tool has five areas provides a list of available values that can be used in calculations.