GLOBAL-VARIABLE

Solved a problem in an elegant manner and want to show off your code? Know a hard-to-find feature? Post it here for the benefit of others. Questions don't belong here.
Post Reply
steve
Posts: 375
Joined: Wed Nov 30, 2011 10:20 pm
Been thanked: 75 times

GLOBAL-VARIABLE

Post by steve » Wed May 17, 2017 12:55 pm

GLOBAL-VARIABLE
(3.3.1.03)

Sets up a variable that can be used across a user session. For example, the user may store a value in one Maths item, for it to be later used by the same user in a different maths or linked action

Global variables will be reset when a user logs in again.

associated commands:
SET-GLOBAL-VARIABLE( <VARIABLE NAME>,<Value> ) - sets the value of a global variable
GLOBAL-VARIABLE( <VARIABLE NAME> ) - gets the current value of a global variable
CLEAR-GLOBAL-VARIABLES ("USER") - clears the current global variables for the user

Example:

Code: Select all

#sets a couple of global variable strings
SET-GLOBAL-VARIABLE( "GVAR1" , " 123" )
SET-GLOBAL-VARIABLE( "GVAR2" , " ABC" )
#Display the global variables
Var1 = GLOBAL-VARIABLE( "GVAR1" )
MESSAGE( Var1 )
#
Var2 = GLOBAL-VARIABLE( "GVAR2" )
MESSAGE( Var2 )

Post Reply