From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Programatically list all groups

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
(2,434 Views)

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

0 Kudos
Message 2 of 4
(2,426 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
(2,425 Views)

To get all just use

data.Root.ChannelGroups
0 Kudos
Message 4 of 4
(2,397 Views)