Appearance
Super Globals
Super Globals are global variables that can be defined by the user. They are always of type Variant.
They are super globals because they are global across the entire Flow system. A super global can be referenced from another map, or from a different execution of the same map.
Super Globals are naturally Persistent. They are persistent across the entire execution of Flow. Therefore only when Flow or FlowServer is restarted will the super globals be reset.
Care should be taken when using super globals that you don't use the same global for different purposes. It would cause a conflict as to the value you expect within the super global at any one time.
Super Globals are referenced like fields through the special Globals array. Their value can be accessed through the properties .Value, .AsString, .AsInteger, and .AsFloat (Refer to Referencing Fields for information on how these properties work with fields - it is the same for super globals).
Setting a super global
pascal
procedure ScriptEvent (var Value : variant);
begin
Globals['MyGlobal'].AsString := 'abc';
end;This example sets a super global called MyGlobal to 'abc'. If the super global does not already exist it will be created. If it does exist it will be updated with the new value.
Reading a super global
pascal
procedure ScriptEvent (var Value : variant);
begin
Value := Globals['MyGlobal'].AsString;
end;This example reads the value of the super global called MyGlobal. If the super global does not already exist it will return a null value (depending on the accessor used - in this case .AsString is used therefore it will return a blank string)
Reading a super global using Tags
Super Globals can be accessed outside of scripts where ever Tags are supported. To access a super global as a tag you should entered the super globals name surrounded by the opening tag <$ and closing tag $>. For example to access a super global called MyGlobal you would enter the tag <$MyGlobal$>
Specifying a display format for AsString and Tags
pascal
procedure ScriptEvent (var Value : variant);
begin
Globals['MyGlobal'].DisplayFormat := 'yyyy-mm-dd';
Globals['MyGlobal'].DisplayFormat := '#0.00';
end;When accessing Float and Datetime type Super Globals with AsString or through Tags, you can control the format of the resulting string value. The above example shows how to set the Display Format. See Number Format Specifiers and Date Format Specifiers for appropriate format specifiers.
Removing a super global
pascal
procedure ScriptEvent (var Value : variant);
begin
Globals.RemoveGlobal('MyGlobal');
end;This example deletes the super global called MyGlobal. If the super global does not exist nothing will happen - you will not receive an error message.
Clear all super globals
pascal
procedure ScriptEvent (var Value : variant);
begin
Globals.ClearAllGlobals;
end;This example deletes all super globals.