« Back to Product

Documentation

SetValue

 bool SetValue (int $VariableID, mixed $Value) 

Parameters

VariableID

ID of the variable

Value

New value of the variable

Returns

If the function succeeds, it returns TRUE, otherwise FALSE.

Description

The function writes the value Value into the IP-Symcon variable with the ID VariableID. It is important to ensure that the type of the set value matches the type of the variable. If the variable has the type String, the value should have the type String as well.

Warning

If the variable and value types do not match, the value is converted to the type of the variable. The result of this conversion can deviate from the expected result. It is recommended to pass the correct type.

Example

SetValue(29117, true);             // Boolean variable: Set flag for school holidays
SetValue(46250, $current_project); // String variable: e.g. "Rain sensing"
Any questions?