Documentation
IPS_GetCategoryIDByName
int IPS_GetCategoryIDByName (string $CategoryName, int $ParentID)
Parameters
| CategoryName | Name of the searched category |
| ParentID | Object whose direct child objects are searched |
Returns
ID of the found category, otherwise FALSE
Description
The function tries to determine the ID of the category called CategoryName whose parent has the ID ParentID. The ID of the first found category whose name matches CategoryName is used. If such a category was found, its ID is returned, otherwise FALSE.
Caution: Names in IP-Symcon can be chosen freely, so they are not unique. For this reason, the function can return a wrong 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 PHP manual.
Example
$CatID = @IPS_GetCategoryIDByName("Rain sensing", $ParentID);
if ($CatID === false)
echo "Category not found!";
else
echo "The category ID is: ". $CatID;