Documentation for Axxon PSIM 1.0.0-1.0.1.

Previous page The GetObjectParentType method  The GetObjectChildIds method Next page


The GetObjectIdByParam method allows you to get the ID of an object, some parameter of which is equal to the specified value. If there are several such objects, the ID of the first found object is returned. If no such objects are found, 0 is returned.

Syntax for method invocation:

function GetObjectIdByParam (obj_type : String, obj_param : String, param_value : String)

Method arguments:

  1. obj_type is a required argument. It specifies the type of system object, the ID of which you want to get.
  2. obj_param is a required argument. It specifies the name of the parameter in the database, by the value of which you want to search for the object.
  3. param_value is a required argument. It specifies the required value of the object parameter.

Example. Find cameras with a black-and-white video image and set the Color parameter to 1 for them.

if (Event.SourceType == "MACRO" && Event.SourceId== "1" && Event.Action == "RUN")
 
{
 var id = GetObjectIdByParam("CAM","color","0"); //get the first object ID
 while (id){ //while exist the Camera objects from which black-and-white image is received
  SetObjectParam ("CAM", id, "color", "1"); //change the Color parameter for found object
  id = GetObjectIdByParam("CAM","color","0"); //get the next object ID
 }
}
  • No labels