ServerObject.IsGroup
The ServerObject.IsGroup property allows a script to determine whether the database item that is referenced by the ServerObject is a Group (Group database item).
Syntax |
ServerObject.IsGroup |
Description |
Indicates whether the database item that is referenced by the ServerObject is a Group. |
Arguments |
None. |
Returns |
Group {Boolean} If the IsGroup returns a True value, the database item referenced by the ServerObject is a Group; if it returns a False value, the ServerObject references a different type of database item. |
Example:
The following script searches for an item. If the item it searches for is a Group, the script performs an additional search, executes a method, and displays a message box.
- Set objTanks = Server.FindObject("Tanks")
- If objTanks.IsGroup = True Then
- Set objLevelPoint = objTanks.FindChild("Tank Level")
- objLevelPoint.Interface.Override 50
- MsgBox "Point Overridden to " &objLevelPoint.Interface.CurrentValue
- End If
Where:
- objTanks is the name of the variable that stores the ServerObject that is returned by the FindObject function.
- Server.FindObject("Tanks") instructs the script to search for a database item named 'Tanks'.
- If objTanks.IsGroup = True Then instructs the script to execute the next line if the ServerObject stored in the objTanks variable references a Group database item.
- Set objLevelPoint = objTanks.FindChild("Tank Level") instructs the script to search for an item named 'Tank Level'. It searches for the item in the Group that is referenced by the ServerObject that is stored in the objLevelPoint variable.
- objLevelPoint.Interface.Override 50 instructs the script to access the Override method of the 'Tank Level' item that is referenced by the ServerObject that is stored in the objLevelPoint variable. The 50 is the parameter for the Override—the 'Tank Level' point is overridden to have a value of 50.
- MsgBox "Point Overridden to " &objLevelPoint.Interface.CurrentValue sets the script to display a message box after the 'Tank Level' point has been overridden. The message box contains the message 'Point Overridden to x' where x is the CurrentValue of the database item that is referenced by the ServerObject that is stored in the objLevelPoint variable, that being the CurrentValue of the 'Tank Level' point.
If the script finds an item named 'Tanks' that is not a Group, it will not attempt to find the 'Tank Level' point and will not perform an Override. Similarly, it will not display a message box.