webCOMAND

#GLOBAL

Define a global variable that will not be removed when exiting the current script execution scope.  #GLOBAL can be called for a variable anywhere in the current scope of the variable, including before or after it is assigned a value.

Prototype

#GLOBAL($variable[, expression])

Parameters

  • variable - Variable, including the dollar sign, to make a global variable.
  • expression - Optional cTemplate expression to be evaluated and result assigned to the variable.  If no expression is provided the variable will be unchanged (even if not set yet), but flagged to be local.

Example

If the following cScript is executed inside the scope of another object (ie. a Template), the $Date variable will remain after the Template is executed.

Template with Identifier "GetDate"

#GLOBAL($Date)
#ASSIGN($Date,'1975-12-20')


#GLOBAL($Date,'1975-12-20')

Publication Procedure

#INSERT(Template,GetDate)
Date: $Date

Result

Date: 1975-12-20