02-13-2013 04:12 AM
Can antbody help..?
I'm trying to create a small routine to delete channles beginning with "T_" and using the * wildcard .
I've tried copying similar examples from the forum but can't seeem to get it to work..
Dim Group, Channels, DataChannel, i
Set Group = Data.Root.ChannelGroups(1)
Set Channels(i)= Data.GetChannels("T_*")
FOR i = 1 TO Channels.Count
Data.Root.ChannelGroups(1).Channels.Remove
NEXT ' i
Solved! Go to Solution.
02-13-2013 07:55 AM
Hey Adek,
Check it out,
Dim oGr, oChn, DataChannel, i
Set oGr = Data.Root.ChannelGroups(1)
Set oChn= Data.GetChannels(""&oGr.Name&"/T_*")
For i=1 to oChn.Count
Call oGr.Channels.Remove(oChn.Item(i).Name)
Next
i assumed that you only want to delete channels in the "first" group. Otherwise just include an additional loop to sweep all your groups
Regards,
Javier
02-13-2013 01:34 PM
Hey Guys,
The GetChannels() method doesn't need to have Group information, so if you want to wildcard just the channel name "T_*", you can do this:
Set Channels = Data.GetChannels("T_*") For Each Channel In Channels Msg = Msg & Channel.ChannelGroup.Name & "/" & Channel.Name & vbCRLF Next MsgBox Msg
Brad Turpin
DIAdem Product Support Engineer
National Instruments
02-14-2013 02:22 AM
Thank you javier,
Very helpful.
02-14-2013 02:23 AM
Hi Brad,
Script now modified.
Regards
Adrian
07-29-2014 04:15 AM
Hi everyone,
I write here to ask for a little help, I am trying to count the number of grupos from a test which name end with "A", I tried to use "*" wildcart to do so, but as i run the script it never count anything as if there where no any group name ending with "A" and I know that there are a lot. Do you know why Wildcarts are not working here?
Thank You
(the script I am using is here)
nBA =0
For i = 1to nGroups
If Data.Root.ChannelGroups(i).Name = ("*A") then
nBA = nBA +1
MsgBox (nBA)
EndIf
Next
07-29-2014 05:54 AM
Hi marispailis
you have to use the string functions to search for goupnames
Dim Group For Each Group in Data.Root.ChannelGroups If lcase(Right(Group.Name,1)) = "a" then call msgbox (Group.Name) End if Next
Hope this helps
Winfried
07-29-2014 06:39 AM
Very Helpfull! Thank you so much 😃