Data Types, Variables, and Constants
In a macro expression, variables can be used in the syntax @VariableName. For information on the types of available variables, see Variables.
In practice, field variables are mostly used. These are variables that refer to fields from the field catalog of a document. The possible data types for variables therefore correspond exactly to the data types listed at Field Catalog for the declaration of fields (see property FieldCatalog[].Field[].InitType):
Text: stringNumber: numeric value with or without decimal placesDate: date/timeBool: Boolean value
There is no explicit distinction between numbers with decimal places and numbers without decimal places, or between date values with time and date values without time. Within the program, these data types always also have a part for a decimal place or for a time, which then may not contain any data. The data type of a variable might vary at runtime. This depends on which value is assigned to the variable as an initial value, as an index field value read in, or as the return value of a macro execution.
Constant values (literals) can be used in a macro expression. The syntax of these constant values is as follows for the various data types:
Data Type | Syntax for Literals |
|---|---|
Text | Embed string "Value": in double quotes ( Write quotation marks of the same type within the value twice: for Within a JSON configuration, on the other hand, define the entire macro expression as a string value in double quotes. In JSON syntax, a |
Number | Numeric values might consist of digits in the range of 0 to 9, a preceding minus sign and a period as decimal separator (e.g., |
Date | Date values without time have the syntax Date values with time have the syntax |
Bool | Boolean values have the two expressions |
Notice
The value NULL is not supported by the macro interpreter. Macro functions do not return NULL values as execution results and are not explicitly designed to handle NULL values as call parameters. Empty values are instead displayed as an empty string ("", 0, 0001-01-01) or as FALSE, depending on the data type. If the specific data type is not known, the empty string is used by default.
Values that were read in via an external database query are an exception. These values can retain the original NULL value. Before further processing a potential NULL value with a macro function that may not be able to handle this value correctly, we recommend carrying out a check with the function IsNull().