integer IPS_GetCategoryIDByName (string $CategoryName, integer $ParentID)
|CategoryName||Name of the searched category|
|ParentID||Object whose child objects are searched|
ID of the found category, otherwise FALSE
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.
Caution: Names in IP Symcon can be chosen freely, so they are not unique. For this reason, the command can return a false ID.
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.
$CatID = @IPS_GetCategoryIDByName("Rain Sensing ", $ParentID); if ($CatID === false) echo "Category not found!"; else echo "The Category ID is: ". $CatID;