Complex expressions
The following is an example of a complex expression that uses multiple names, operators, and literal data. It is preceded by a question mark so that when it’s typed into the Command window, it displays the resulting value:
? {"1st","2nd","3rd","4th"}[ ceiling( month( date( )) / 3 ) ] + " quarter"
Except for the question mark, the entire line is a single complex expression, made up of many smaller basic expressions. The expression is evaluated as follows:
A literal array of literal strings is enclosed in braces, separated by commas. The strings are enclosed in double quotation marks.
The resulting array is referenced using the square brackets as the index operator. Inside the square brackets is a numeric expression.
The numeric expression uses nested functions, which are evaluated from the inside out. First, the DATE( ) function returns the current date. The MONTH( ) function returns the month of the current date.
The month is divided by the number 3, then the CEILING( ) function rounds the number up to the nearest integer.
The string containing the ordinal number for the calendar quarter that corresponds to the month of the current date is extracted from the array, which is then added to the literal string "quarter".
The value of this complex expression is a string like "4th quarter".