SetVar Method

Description
Sets the value of a SPEL+ global preserve variable in the Controller.

Syntax
Sub SetVar (VarName As String, Value As Object)

Parameters

  • VarName
    SPEL + backup variable name
  • Value
    Value to set

Remarks
You can use SetVar to set the values for single variables and array variables. See the examples below.

See Also
GetVar Method

SetVar Example
VB Example:

m_spel.SetVar("g_myIntVar", 123)  
  
Dim i, myArray(10) As Integer  
For i = 1 To 10  
  myArray(i) = i  
Next i  
m_spel.SetVar("g_myIntArray", myArray)  
  
m_spel.SetVar("g_myIntArray(1)", myArray(1))  

C# Example:

m_spel.SetVar("g_myIntVar", 123);  
  
int[] myArray = new int[10];  
for(int i = 1; i < 10; i++)  
	myArray[i] = i;  
  
m_spel.SetVar("g_myIntArray", myArray);  
  
m_spel.SetVar("g_myIntArray[1]", myArray[1]);