« Back to Product

Documentation

IPS_GetVariableIDByName

 int IPS_GetVariableIDByName (string $VariableName, int $ParentID) 

Parameters

VariableName

Name of the variable

ParentID

Object whose children are searched

Returns

ID of the found variable, otherwise FALSE

Description

This function tries to determine the ID of the variable called VariableName whose parent has the ID ParentID. It will use the ID of the first found variable whose name matches VariableName. If such a variable was found, its ID is returned, otherwise FALSE.

Unlike IPS_GetVariableID, the parent ID is used as an additional criterion. Thus, the probability to find the intended ID increases significantly. Remember:

Warning

Caution: Names in IP Symcon can be chosen freely, so they are not unique. For this reason, the function can return a false ID.

Warning

This function generates a warning if the name was not found. Use the @ operator, if you want to suppress this message. The exact functionality of this operator can be found in the PHP manual.

Example

$VarID = @IPS_GetVariableIDByName("Rain fall", $ParentID);
if ($VarID === false)
    echo "Variable not found!";
else
    echo "The Variable ID is: ". $VarID;
Any questions?