Rockwell Automation 9307 FactoryTalk EnergyMetrix User Manual

Page 255

Advertising
background image

9

ReportsPlus

255

NestedGroups Collection

The NestedGroups object is similar to the Report.Groups object in that it contains a
collection of Group objects. However, Report.Groups is a flat array of Groups, while
Report.NestedGroups is a hierarchical collection of Group objects that mimics the tree
structure of the report selection tree. The members of the collection are selected in the
MPR setup. See

Selecting Groups and Meters in the MPR on page 226

for more

information.

Instancing

The NestedGroups object is a creatable object.

Accessing

The Report object automatically creates one NestedGroups object (accessible using the
Report.NestedGroups property) and MPR script code can create additional Groups objects
if needed.

Using nested groups requires recursion to traverse all selected children groups. See the
example below.

Properties

Example

The following sample MPR script demonstrates the use of recursion to select nested
groups.

Dim grid As New Grid

Dim row As Row

Sub Main()

Dim group As Group

Dim col As Col

col = grid.AddCol("Name") : col.Width = 10

' First call of recursive procedure

For Each group in Report.NestedGroups

row = grid.AddRow()

row(0) = group.Name

BuildNestedGroupsGrid(group, " ")

Next group

Report.Add(grid,0,0)

End Sub

Sub BuildNestedGroupsGrid (parentGroup As Group, tabSpace As
String)

Dim group As Group

' Add children groups to grid and call itself recursively

For Each group in parentGroup.Groups

row = grid.AddRow()

Property

R/W

Description

Group(index) As Group

R

Collection of Group objects that represent the
groups that are selected in the report's groups/
meters tree

Advertising