DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Programatically list all groups

Highlighted

Hello,

I am trying to list all my groups in my data using GetChannelgroups() but it is only getting the last group. To show this, I opened a new DIAdem file with the example groups - EXAMPLE, Noise data, Results_Noise data, Room temperatures. It might be important to note that in the Data Portal, Room temperatures is bold. In the Script, I'm doing the following:

Dim oMyChannelGroups, oMyChnGrp
Set oMyChannelGroups = Data.GetChannelGroups("[]")
For Each oMyChnGrp in oMyChannelGroups
  Call MsgBoxDisp(oMyChnGrp.Name)
Next

which only prints "Room temperatures". Is there a way to get all the group names?

0 Kudos
Message 1 of 4
(549 Views)

I figured it out! I misunderstood the explanation of the function. I needed to do `Data.GetChannelGroups("*")'.

0 Kudos
Message 2 of 4
(541 Views)

Your script is correct, simply replace the square brackets with a wildcard '*'.

Set oMyChannelGroups = Data.GetChannelGroups("*")

Empty square brackets returns only the default group.

0 Kudos
Message 3 of 4
(540 Views)

To get all just use

data.Root.ChannelGroups
0 Kudos
Message 4 of 4
(512 Views)