ServerObject.Children
The ServerObject.Children property allows a script to collect all items in a database Group so that it can interact with each 'child' item in the Group in turn.
Syntax |
ServerObject.Children |
Description |
Collects the items in a Group, allowing the script to interact (read, write, issue controls and so on) with each item in a Group in turn. |
Arguments |
None. |
Returns |
None. |
Example:
In this example, the ServerObject.Children property is used to allow a script to override each point in a group named 'Pipeline Controls' to a value of 50:
- Set objValveGrp = Server.FindObject("Pipeline Controls")
- If Not(objValveGrp Is Nothing) Then
- For Each Point In objValveGrp.Children
- If Point.Interface.TypeName = "CPointAlgManual" Then
- If Point.Interface.OverrideAllowed Then
- Point.Interface.Override 50
- End If
- End If
- For Each Point In objValveGrp.Children
- Next
- End If
Where:
- objValveGrp is the name of the variable that stores the ServerObject that is returned by the FindObject function.
- Server.FindObject("Pipeline Controls") instructs the script to search for a database item named 'Pipeline Controls'.
- If Not(objValveGrp Is Nothing) Then instructs the script to perform the subsequent actions only if the objValveGrp variable contains a ServerObject i.e only proceed with the script actions if the 'Pipeline Controls' item is found.
- For Each Point In objValveGrp.Children instructs the script to perform the actions on each point that is a child of the Group referenced by the ServerObject stored in the objValveGrp variable. So, the script should only perform the actions on points in the 'Pipeline Controls' Group.
- If Point.Interface.TypeName = "CPointAlgManual" Then instructs the script to only perform the subsequent actions on those points that have a TypeName property value of "CPointAlgManual', which means only perform the actions on analog points. This line is required so that the script will work if there are digital points in the 'Pipeline Controls' Group (it will ignore the digital points).
- If Point.Interface.OverrideAllowed Then instructs the script to only perform the subsequent actions on those analog points that have an OverrideAllowed property value set to True i.e. those points that have Overrides enabled on their Forms. This line is needed so that the script can ignore those analog points that have Overrides disabled.
- Point.Interface.Override 50 instructs the script to override the analog points (that have Overrides enabled) to a value of 50.
- Next sets the script to repeat the process for the next analog point in the Group.