Server.FindObject

The FindObject function is a server function that allows a script to locate an item in the database. The FindObject function returns a ServerObject that has its own functions and properties.

Syntax

Server.FindObject (Name)

Description

Locates an item in the database and allows a script to manipulate the item.

The FindObject function returns a ServerObject. A ServerObject is
a Geo SCADA Expert specific script object that has its own functions and properties which can be manipulated.

Arguments

Name {string}

Defines the name of the item in the database that you want to find. It returns a reference to an object.

Returns

ServerObject

A reference to an item in the database. The returned ServerObject has its own ServerObject Functions and ServerObject Properties.

The FindObject function does not allow relative paths. However, you can work around this by using the Server.GetOPCValue function. For an example of how the Server.GetOPCValue and FindObject functions can be used together, see ComboBox.Selection.

Example: 1

Set objAI1Point = Server.FindObject ("AI1")

MsgBox "This Sensor is" &objAI1Point.Name


Where:

  • objAI1Point is the variable that is used to store the ServerObject that is returned by the FindObject function.
  • ("AI1") is the name and location of the database item that is to be searched for by the FindObject function. In this case, it is a point named "AI1" that is located in the root of the system.
  • MsgBox "This Sensor is" instructs the script to display a message box containing the text "This Sensor is"
  • &objAI1Point.Name instructs the script to add the Name value of the ServerObject (that is returned by the FindObject function and stored in the objAI1Point variable) to the message box. When the message box is displayed, it contains the message "This Sensor is AI1".

Example: 2

Set objPoint = Server.FindObject(Server.ThisObject.Parent.FullName + "DigitalPoint1")

objPoint.Interface.Override 1


Where:

  • Set objPoint = Server.FindObject instructs the script to use the Server FindObject function to locate the database item that provides the value for the 'objPoint' variable.
  • (Server.ThisObject.Parent.FullName + "DigitalPoint1") defines the location of the database item. The location is defined by a Server property (Server.ThisObject) and a ServerObject property (Parent). The Server and ServerObject properties instruct the script to begin the search at the parent of the group that contains the Mimic (the Mimic is ThisObject). FullName + "DigitalPoint1" instructs the script to search for the database item that has a FullName value that matches "DigitalPoint1".
  • objPoint.Interface.Override 1 instructs the script to use the Interface of the objPoint variable to perform an Override with a value of 1. The Interface is a ServerObject property and it provides access to the point's methods, properties and so on.

See also:

Server.RootObject

Server.ThisObject.


Disclaimer

Geo SCADA Expert 2022