From Clomosy Docs

Global variables are variables that are defined and can be used in any part of a program. These variables are typically defined in the main part of the program, which is accessible to all functions and procedures. Global variables are often used to store the state of the program or general settings.

The Clomosy platform provides functions for defining global variables. These functions are designed to store values that will be commonly used across different units.
For example, if a string variable defined on the Main Code page needs to be sent to the next page (Unit) and used there, it can be defined using these functions.

In Clomosy, there are different types of global variable usages. These predefined global definitions can facilitate data transfer between pages based on the type of data.


GlobalVariableString

It is the function used to store data of the string data type.
To assign data to a variable:

To retrieve data assigned to a global variable:

Example

var
  userName  : String; 
{
 userName = 'XName';
 Clomosy.GlobalVariableString = userName;
 ShowMessage(Clomosy.GlobalVariableString);
}

GlobalVariableInteger

It is the function used to store data of the integer data type.
To assign data to a variable:

To retrieve data assigned to a global variable:

Example

var
  userId  : Integer; 
{
 userId = 11;
 Clomosy.GlobalVariableInteger = userId;
 ShowMessage(Clomosy.GlobalVariableInteger);
}

GlobalVariableDateTime

It is the function used to store data of the TclDateTime data type.

To assign data to a variable:

To retrieve data assigned to a global variable:

Example

var
  dateTime  : TclDateTime; 
{
 dateTime = Now;
 Clomosy.GlobalVariableDateTime = dateTime;
 ShowMessage(Clomosy.GlobalVariableDateTime);
}

GlobalVariableStringList

It is the function used to store and keep an array of the TclStringList data type.

Example

var
  productList,incomingProductList: TclStringList;
  i: Integer;
{
  productList = Clomosy.StringListNew;
  productList.Add('Product 1');
  productList.Add('Product 2');
  productList.Add('Product 3');
  Clomosy.GlobalVariableStringList = productList;
  
  //The retrieved string list should be assigned to another list and displayed on the screen.
  incomingProductList = Clomosy.StringListNew;
  incomingProductList = Clomosy.GlobalVariableStringList;
  for (i = 0 to incomingProductList.count - 1)
    ShowMessage(Clomosy.StringListItemString(incomingProductList,i));
}

See Also