The @ statement

The statement @(formula or variable) places the value stored in the variable or the result of the formula in the result document. It can only be used within a text part of a Master Template.

Template scripts consist of KCM code and text. The switch between these modes is made with the hash sign. To put the value of variables or retrieved data in the text, use @(formula or variable).

When switching from code mode to text mode, any whitespace characters after the hash sign till the first non-whitespace character, or till and including the first paragraph sign, whichever comes first, are ignored.

Example

#BEGIN
#······Text····¶
················#           
END#

Results in


Text····¶
················

The statement @(expression) outputs the result of the expression into the result document. It can only be used within the text parts of a Master Template.

The output depends on the type of the expression:

  • A TEXT value is produced word for word.
  • A NUMBER value is formatted as a number with thousand-separators and 2 decimal positions.
  • A BOOL value produces the text TRUE or FALSE, localized to the active output language.

Other types of expressions cannot be used directly with the @(...) statement and causes an error during Template compilation.

An example is provided here.

TEXT text := "The Quick Brown Fox..."
NUMBER number := 1234567
BOOL bool := (0 = 1)
#
Text value: @(text).
Number value: @(number) or @(numerals(number)).
Boolean value: @(bool).
#

This example produces:

Text value: The Quick Brown Fox....

Number value: 1,234,567.00 or 1234567.

Boolean value: FALSE.