« 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 function tries to determine the ID of the instance named InstanceName, whose parent has the ID ParentID. The ID of the first instance found whose name matches InstanceName is used. If such an instance 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 function 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 behavior of this operator is described 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?