ServerObject.Interface
The ServerObject.Interface property allows a script to access the properties, methods and aggregates of the database item that is referenced by the ServerObject. For example, if a script is to issue a control to a point, the point will be referenced by a ServerObject in the script and the ServerObject.Interface property will be used to access the point's control.
Syntax |
ServerObject.Interface |
Description |
Provides access to the properties, methods, and aggregates of the database item that is referenced by the ServerObject. |
Arguments |
None. |
Returns |
Value {variant}. When reading a property value, the Interface property returns a value. The value is a variant (string, integer, Boolean and so on, depending on the type of value being read). |
Example 1: Calling a Method
The following script is used to override a point so that its value is 10:
- Set objPoint = Server.FindObject(Server.ThisObject.Parent.FullName + ".DigitalPoint1")
- objPoint.Interface.Override 10
Where:
- Server.FindObject(Server.ThisObject.Parent.FullName + "DigitalPoint1") instructs the script to search for a point named 'Digital Point1' that is stored in the same group as the Mimic that contains the script. If the script locates a suitable point, the reference is returned as a ServerObject.
- objPoint.Interface.Override 10 instructs the script to access the Override method of the item that is referenced by the ServerObject that is stored in the objPoint variable. To access the Override method, the script has to use the ServerObject's Interface property. The number 10 is the parameter for the Override, this means the script overrides the 'Digital Point1' point to a value of 10.
Example 2: Calling an Aggregate
The following example is used to call the historic aggregate on a point:
- Set ObjPoint = Server.FindObject(".Main Valve")
- ObjPoint.Interface.Historic=True
- ObjPoint.Interface.Historic.Compress = 1
Where:
- Server.FindObject(".Main Valve") is used to locate the database item named 'Main Valve'. In this case, the 'Main Valve' item is a point. The ServerObject that is returned by the FindObject function is stored in the ObjPoint variable.
- ObjPoint.Interface.Historic=True is used to set the point's historic setting to enabled. The Interface property is used to access the point's Historic aggregate (and True means it is set to Enabled).
- ObjPoint.Interface.Historic.Compress = 1 is used to enable the compression feature for the point's historic data. The Interface property is used to access the Compress property of the point's Historic aggregate (and 1 sets the Compression feature to enabled).
For a more detailed example of a script being used to call an aggregate, see Using a Script to Access Aggregates.
Example 3: Reading a Value
The following script displays a message box that contains the Current Quality Description value of a database point:
- Set objTankLevel = Server.FindObject("Tanks.Tank Level")
- MsgBox "Tank Level Quality = " &objTankLevel.Interface.CurrentQualityDesc
Where:
- objTankLevel is the name of the variable that stores the ServerObject that is returned by the FindObject function.
- Server.FindObject("Tanks.Tank Level") instructs the script to search for a point named 'Tank Level' that is located in a Group named 'Tanks'. It returns a ServerObject that references the 'Tank Level' point.
- MsgBox "Tank Level Quality = " &objTankLevel.Interface.CurrentQualityDesc instructs the script to display a message box that contains the message 'Tank Level Quality = x' where x is the value for the point's CurrentQualityDesc property. The CurrentQualityDesc property is accessed via the ServerObject's Interface property.