integer IPS_GetVariableIDByName (string $VariableName, integer $ParentID)
|VariableName||Name of the variable|
|ParentID||Object whose children are searched|
ID of the found variable, otherwise FALSE
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:
Caution: Names in IP Symcon can be chosen freely, so they are not unique. For this reason, the function can return a false ID.
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.
$VarID = @IPS_GetVariableIDByName("Rain fall", $ParentID); if ($VarID === false) echo "Variable not found!"; else echo "The Variable ID is: ". $VarID;