Skip to content

Using System Variables

Summary

In MFGStream the concept of the variable has been expanded beyond standard in-code variables to include session-wide variable values which are stored within a terminal session and can be passed between terminal functions. Once a terminal session is closed, the MFGStream variables collection is cleared. That said, a key difference between session variables and environment level variables is the fact that environment variables persist for the lifespan of the environment rather than a given session. Additionally, MFGStream environment variables are read-only while session variables can be written to and read from at any point in a script. That said, session variables are typically destroyed when a terminal session is closed.

Session Variables

Key functions used:

Function
MFGS.Variables.Set
MFGS.Variables.Get
Dim value As String
value = MFGS.Variables.Get("Var1", "Default Value")
Dim myString As String
myString = "This is a test value"
MFGS.Variables.Set("Var1", myString)

Environment Variables

As the name implies, this type of variable exists at the MFGStream environment (server) level and are created/destroyed with environment startups and shutdown. Additionally, environment variables are shared across all terminal sessions and are read-only from within MFGStream scripts.

Key functions used:

Function
MFGS.Environment.Get
Dim environmentValue As String
environmentValue = MFGS.Environment.Get("EnvVar1", "Default Value", "CategoryName")