DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

using getchannels to move channel to different channelgroup

Solved!
Go to solution

I am trying to move all of my flow channels to group 4.  they are currently spread throughout several channelgroups.

 

Dim oMyChn

Dim oMyChannels

Set oMyChannels = Data.GetChannels("*FLOW*")

For Each oMyChn in oMyChannels

 

CallMsgBoxDisp(oMyChn.Name)

 

CallData.Move(data.Root.ActiveChannelGroup.Channels(oMyChn),Data.Root.ChannelGroups(4).Channels)

 

Next

 

I am getting an error stating that "the argument transferred to Item must be either a string or an integer"

 

Can someone help?

0 Kudos
Message 1 of 4
(6,598 Views)

Nevermind.

I finally got it 🙂

 

Dim oMyChn

Dim oMyChannels

Set oMyChannels = Data.GetChannels("*FLOW*")

For Each oMyChn in oMyChannels

 

Call MsgBoxDisp(oMyChn.Name)

 

oMyChn.ChannelGroup.Activate

 

CallData.Move(Data.Root.ActiveChannelGroup.Channels(oMyChn.Name),Data.Root.ChannelGroups(4).Channels)

Next

0 Kudos
Message 2 of 4
(6,591 Views)
Solution
Accepted by topic author 2Pale4TX

Hi Everyone,

 

I'd like to recommend the following alternative syntax as easier to debug and faster performing:

 

Set FlowChannels = Data.GetChannels("*/*FLOW*")
jMax = FlowChannels.Count
FOR j = 1 TO jMax
  Call Data.Move(FlowChannels(j), Data.Root.ChannelGroups(4).Channels, j)
NEXT ' j

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

Message 3 of 4
(6,563 Views)

Thanks Brad.

I will adjust my script.

 

 

0 Kudos
Message 4 of 4
(6,561 Views)