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: 

Delete channels (by name) in any group

I load a few dozen groups, with some similar (and some unique) channel names.

 

The first group I load is the template of data I "care" about, and I want to delete all channels in all groups that don't match one of those "template" names. Having issues. Tried multiple solutions.

 

Dim ChannelTemplate, i

Set MyChannelNames = Data.GetChannels("[2]/*") 'Gather the channel names from Template

 

i = 1

 

Set ChannelTemplate = Data.GetChannels(Str(MyChannelNames(i).Name)) 'equal to all channels that meet this name... but it only finds it in this group

 

Call ChnDelete("*/" &TemporaryString) 'Delete all channels found in the above line

 

 

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

Hello

 

You might try the code below.   The trick is that you have to delete the highest numbered channel first in the Channel list.

 

The code below will sort the channel numbers and then delete from the highest number down to the lowest.

 

Paul

 

 

0 Kudos
Message 2 of 4
(6,151 Views)

Hi rlbodor,

 

If your DIAdem version is new enough, I prefer passing the channel collection variable to the Data.Remove() method:

 

Set MyChannels = Data.GetChannels("[1]/*")
Call Data.Remove(MyChannels)

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 3 of 4
(6,119 Views)

I may be wrong but reading through teh question again, rbodor wants to delete those channels in groups 2 and following which DO NOT exist in group one.

The previous two answers show a solution to delete the channels which DO exist

 

Try the example in the attached file.

 

Andreas

 

 

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