Global variables Tcl interface usage

Global variables can simplify development and deployment of Cloverleaf interfaces.

These variables are defined once in a Cloverleaf site and can be used multiple times in these configuration files within that Cloverleaf site:

  • NetConfig protocol parameters. For example, port number, directory path, and web services URL.
  • Xlate files. For example, constants in input fields.
  • Lookup tables. For example, input or output values.
  • Arguments to UPoCs
  • Alert definition entries

This table shows the global variables Tcl interface usage:

Global variable command Usage Variable Result
gvsubstring stringvalue Substitutes the global variable by its value in the string. stringvalue: The string includes global variables.

Returns the string with global variable substituted.

gvsubfile inputfilename ?outputfilename? Substitutes the global variable by its value in the file. inputfilename: The absolute path of the file that includes global variables.

outputfilename: The absolute path of the file to save the result. If not given, then the result is written to the input file.

Returns empty if success or the error message if an error.
gvaddvar varname varvalue ?isencrypted? Adds the variable name and value to the table in memory. varname: The global variable name.

varvalue: The global variable value.

isencrypted: If the global variable value needs be encrypted.

"1" is encrypted

"0" or others is not encrypted.

Default is 0.

Returns empty if success, or the error message if an error.
gvdelvar varname Deletes a global variable by name. varname: The global variable name. Returns empty if success or the error message if error.
gvsetvar varname varvalue ?isencrypted? Sets the global variable value in mermory. varname: The global variable name.

varvalue: The global variable value.

isencrypted: If the global variable value requires encryption.

"1" is encrypted

"0" or "others" is not encrypted.

Default is 0.

Returns empty if success or the error message if an error.
gvgetvar varname Gets the global variable value by name. varname: The global variable name. Returns the global variable value if success, or the error message if an error.
gvprint Prints out the global variable table in memory.
gvsave Saves the global variable table in memory to the global variable ini file. Returns empty if success, or an error message if an error.