Assignment operator

The assignment operator (:=) assigns a value on the righthand side to a variable on the lefthand side. The variable assumes the type of the value on the righthand side.

This example assigns the numeric value 1 to the temporary variable n.

n := 1

This example increments the temporary variable n by 1.

n := n + 1

This example assigns the text value "London" to the temporary variable city1.

city1 := "London"

The variable may be preceded by the reserved word DEFAULT, ENVIRONMENT, or FIELD. A variable not preceded by a reserved word is a temporary variable.

An assignment statement can be nested in an operation. The following example assigns "London" to the variable city1 as well as the value "LONDON" to city1Upper:

city1Upper := @UpperCase(city1 := "London")

This example, when used in a computed for display text field, displays the results of calculating the hotel, dinner, and nights editable number fields once a user enters their values and refreshes the document:

all := @Text(nights * each := hotel + dinner);
@If(hotel="";"";"She spent " + @Text(each) + " per night and " + all + " in total on accommodations during the trip.")

The FIELD reserved word can be used with a nested assignment. For example:

FIELD CityUpper := @UpperCase(FIELD City := "London" )

The DEFAULT and ENVIRONMENT keywords cannot be used with a nested assignment statement.

Note: Nesting assignment statements is new with Release 6.