Skip to content

Dim as global

Description

This statement declares a list of global variables. Each variable declaration must be separated by a comma. Global variables are persistent throughout the report and sub-report(s).

To declare a global array variable, you must supply a comma-separated list of the number of elements for each dimension enclosed in square brackets. You can only declare static arrays, meaning you cannot resize the number of elements after declaration.

The number of elements for each dimension can only be integer constants, unlike local variables where expressions are allowed.

The name of the variable must start with a letter, followed by any number of alphanumeric characters. Operators, quotes, and underscores are not allowed in a variable name.

Array variables cannot be global.

Syntax

Dim <Variable> [, <Variable>…] as global

Where square brackets indicate optional parts of the statement and ‘…’ indicates more occurrences are allowed.

Sample

Dim gTotal as global

Let gTotal = 1

Return gTotal // The global variable is also available in other functions