GetGlobalVar

Fetch a global variable by name

Signature

public T GetGlobalVar<T>(string varName, bool persisted = true)

Parameters

varName
string required

The string name of the global variable

persisted
bool
Default:
True

To get, set, or unset persisted global variables, set to true or leave empty.

To get, set, or unset temporary/non-persisted global variables, set to false.

Return Type

T

Example

using System;
public class CPHInline
{
    public bool Execute()
    {
        //Examples on usage
        //Get integer number from persisted global variable
        int myInt = CPH.GetGlobalVar<int>("myInt"); 
        //Get string/text from persisted global variable
        string myString = CPH.GetGlobalVar<string>("myString",true); 
        //Get string/text from non-persisted global variable
        string myString = CPH.GetGlobalVar<string>("myString",false); 
        return true;
    }
}