« Back to Product

Documentation

IPS_GetCategoryIDByName

 int IPS_GetCategoryIDByName (string $CategoryName, int $ParentID) 

Parameters

CategoryName

Name of the searched category

ParentID

Object whose child objects are searched

Returns

ID of the found category, otherwise FALSE

Description

The command is trying to determine the ID of the category called CategoryName whose parent has the ID ParentID. It will return the ID of the first found object whose name matches with CategoryName. If no category with that name was found, FALSE is returned.

Warning

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

Warning

This function generates a warning if the name was not found. The @ operator can be used to suppress this message. The exact functionality of this operator is explained in the the PHP manual.

Example

$CatID = @IPS_GetCategoryIDByName("Rain Sensing ", $ParentID);
if ($CatID === false) 
    echo "Category not found!";
else
    echo "The Category ID is: ". $CatID;
Any questions?