What can we improve?

Documentation

(Edit)

IPS_GetObjectIDByIdent

Requires: IP-Symcon >= 2.5

integer IPS_GetObjectIDByIdent (string $ObjectIdent, integer $ParentID)

Parameters

ObjectIdent The searched object identificator
ParentID ID of the object whose children object are searched

Returns

ID of the found object, otherwise FALSE

Description

This function tries to detect the object with the ident ObjectIdent whose parent object has the ID ParentID. If such an object is found, its ID is returned. Otherwise, this function returns FALSE.

The parameter "ObjectIdent" must not be an empty string ("").

Difference to IPS_GetObjectIDByName: As idents of objects are unique within an individual level, either a single ID is returned or a warning is generated.

This function generates a warning if the ident is not found. The @ operator can be used to supress this message. Please see the PHP manual for the exact functionality of this operator.

Example

// This function can be used to replace IPS_StatusVariableExists
// Example for IPS_StatusVariableExists($id, "StatusVariable");
echo !(@IPS_GetObjectIDByIdent("StatusVariable", $id) === false);
 
// In addition, the function can be used to replace IPS_GetStatusVariableID
// Example for IPS_GetStatusVariableID($id, "StatusVariable");
echo IPS_GetObjectIDByIdent("StatusVariable", $id);
 
 
$id = IPS_GetObjectIDByIdent($VariableIdent, $InstanceID);        
$v = IPS_GetVariable($id);
 
// Array since 4.0
$sv = Array(
    "VariableID" => $id,
    "VariableIdent" => $VariableIdent,
    "VariableName" => "N/A",
    "VariablePosition" => 0,
    "VariableProfile" => $v['VariableProfile'],
    "VariableType" => $v['VariableType'],
    "VariableHasAction" => ($v['VariableAction'] > 0),
    "VariableUseAction" => ($v['VariableAction'] > 0)
);
 
// Array until 3.4
$sv = Array(
    "VariableID" => $id,
    "VariableIdent" => $VariableIdent,
    "VariableName" => "N/A",
    "VariablePosition" => 0,
    "VariableProfile" => $v['VariableProfile'],
    "VariableType" => $v['VariableValue']['ValueType'],
    "VariableHasAction" => ($v['VariableAction'] > 0),
    "VariableUseAction" => ($v['VariableAction'] > 0)
);
Deutsche Webseite verfügbar
Go to cart
Any questions?