Global variables
Sometimes it is useful to publish information so that it is available for another script or during the next execution of the same script. To achieve this, it is possible to store a value in an INI file or to use a dedicated data table in the project. However, the scripting engine provides a more convenient way - you just need to define a named global variable and this variable becomes visible among all the scripts until FieldMap is closed or until the variable is explicitly removed.
Global variables are of a type variant, so they can hold any of the basic data types.
The following statement defines a global variable named "MyVar' with the value 'my text' :
Globals['MyVar'] := 'my text';
Other scripts can easily access this variable:
ShowMessage(Globals.Value['MyVar']);
The Value is a default one, so it can be simply left out:
ShowMessage(Globals['MyVar']);
If desired, the global variable can be removed from the memory:
Globals.RemoveGlobalVariable('MyVar');
For more information, see the detailed description of the individual members listed below.
In this chapter:
© 2024 IFER-Monitoring and Mapping Solutions