« Back to Product

Documentation

IPS_GetInstanceIDByName

 int IPS_GetInstanceIDByName (string $InstanceName, int $ParentID) 

Parameters

InstanceName

Name of the searched instance

ParentID

Object whose child objects are searched

Returns

ID of the found instance, otherwise FALSE

Description

The command is trying to determine the ID of the Instance called InstanceName, whose parent has the ID ParentID. It will return the ID of the first found object whose name matches with the InstanceName. If such an object is found, its ID is returned, otherwise FALSE.

Warning

Caution: Names in IP-Symcon can be chosen freely, so they are not unique. For this reason, the command can return a wrong 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 function of this operator is found in the PHP manual.

Example

$InstanceID = @IPS_GetInstanceIDByName("Rainfall", $ParentID);
if ($InstanceID === false)
    echo "Instance not found!";
else
    echo "The Instance ID is: ". $InstanceID;
Any questions?