An expression can contain any combination of literal values, operators, functions, and references to data fields.
Using numbers and dates in an expression
When you create an expression that contains a literal number or a literal date, type the number or date according to the conventions of the English (United States) locale. In other words, for a number, use a period (.), not a comma (,), as the decimal separator, and for a date, type 03/12/2007 to represent March 12, 2007, even if you are working in, for example, the French (France) locale. For example:
Correct: ([Quantity] * [Price]) * 1.5
Incorrect: ([Quantity] * [Price]) * 1,5
Enclose literal date values in double quotation marks (" "), as shown in the following expression, which calculates the number of days from the order date to Christmas:
DIFF_DAY([OrderDate], "12/25/08")
Using reserved characters in an expression
Some characters are reserved for internal use and have a special meaning. For example, Report Studio uses brackets to denote a data field. The following characters are reserved in Report Studio:
[
]
?
' (single quotation mark)
If the name of a data field contains a reserved character, Report Studio encloses the reserved character in single quotation marks (') when you select the data field for use in an expression, for example, '['. If the name of a data field is OBSOLETE?, Report Studio changes it to [OBSOLETE'?'] in the expression. If you type [OBSOLETE?] in the expression, the dialog box displays an error message.
To minimize syntax errors, select the field from the list in the Calculation dialog box and allow the software to construct the expression, instead of typing it yourself. The following examples show the appearance of data fields containing reserved characters in the Calculation dialog box. The examples show both versions of the names, the changed name and the original name with reserved characters, as follows: