Skip to main content

xSuite Interface Windows Prism 5.x – Online Help

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: string

  • Number: numeric value with or without decimal places

  • Date: date/time

  • Bool: 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 ("value"). When embedding a JSON string in double quotes, you can use single quotes to avoid the necessary masking ('value').

Write quotation marks of the same type within the value twice: for Say "Hello", for example, you would write Say ""Hello""". You do not have to do this for quotation marks of the other respective type, making 'Say "Hello"' a valid alternative spelling.

Within a JSON configuration, on the other hand, define the entire macro expression as a string value in double quotes. In JSON syntax, a \" serves to mask inner (double) quotes ("\"Say \"\"Hello\"\"\""). When manually editing JSON data, single quotes should be preferred for better readability within the macro expression.

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., 123, -123 or 1.23).

Date

Date values without time have the syntax yyyy-MM-dd (e.g., 2021-12-31).

Date values with time have the syntax yyyy-MM-dd HH:mm:ss (e.g., 2021-12-31 23:59:00).

Bool

Boolean values have the two expressions TRUE and FALSE in any variant of upper and lower case.

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().