Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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

Syntax of for method invocation:

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

Method arguments:

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

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

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