Skip to content

Flow documentation · legacy product

Variables ​

A Variable is a placeholder to store a value. A variable is called a Parameter when it is an input to a function (Refer Parameters).

A user can also declare local variables making them available for use within the script. A variable is declared before the begin...end block of the script skeleton (Refer Scripts).

pascal
procedure ScriptEvent (var Value : variant);
var
  MyVariable : Integer
  MyVariable2 : String
begin

end;

A variable is declared as a certain data type indicating the type of data the variable can store. The syntax for declaring variables is

pascal
var <VariableName> : <DataType>;

var is a keyword indicating you are declaring a variable. If declaring multiple variables you only need this once at the start of the list of variables. See example below

<VariableName> is the desired name of the variable and can be what ever the user desires (However the first character should always be a alpha character from A-Z)

<DataType> is one of the supported Data Types.

A variable has a scope which indicates the availability of the variable from within the script. Scope is described as either Local or Global. A Local variable is only available within the script it is declared. A Global variable is available within any script within the map.

Variables are also either Persistent or Non-Persistent. All variables declared by the user are non-persistent. Non-persistent variables do not retain their value between executions of the script, they always start as null each time the script executes. For example, in a script assigned to the OnMap event of a field, a variable will start as null each time the script executes (it will execute once for each record being processed). Persistent variables retain their value between each execution of the script.

TIP

Note: Any variables declared by a user are Local variables and only available within the script they are declared within. User declared variables are non-persistent - they will start as null each time the script executes.

DANGER

A user cannot declare Global variables.

Some examples of declaring a variable are;

var MyVariable : String declares a variable called MyVariable of String (String, Widestring) data type

var Temp : TDateTime declares a variable called Temp of Datetime (TDateTime) data type

var Total : Double; Count : Integer; Temp : String; declares three variables. The first is called Total of Float (Double, Extended, Currency) data type, the second is called Count of Integer (Integer, Cardinal, Int64) data type, and the third is called Temp of String (String, Widestring) data type.

TIP

Variable names are not case sensitive in a script. If you declare as MyVariable you can reference it is myvariable

As well as local variables declared by the user as above, there are also special variables that are available within the script engine:

Special VariablePredeclared NamesData TypeScope / Persistence
Global VariablesGlobal1 to Global10VariantAcross Events in one execution of a Map
Global DatasetsData1 to Data10
(to Data35 in recent versions)
TFloClientDataSetAcross Events in one execution of a Map
Super GlobalsGlobals['<anyname>']VariantThe lifetime of that Flow session in memory
(or until RemoveGlobal or ClearAllGlobals)
Local GlobalsLocals['<anyname>']VariantAcross Action Steps in one execution of an Action
(or until RemoveLocal or ClearAllLocals)