Showing results for 
Search instead for 
Did you mean: 

Script : object of filtered channel

Go to solution

Script : object of filtered channel

Hello. community.

What is script sentence for calling filtered channel?


for example, when if I searched 't' for whole group in data portal, then the all named 'T'ime channel are shown in result.

Then, when if I want to make new group having Time channel only as script using general objective for filtered channel. Is there any way I can do?
(except the way calling such as below..........[1]/Time, [2]/Time, [3]/Time..) I want to make this small process automatically. 

Call ChnClpCopy("'[2]/Time', '[3]/Time', '[4]/Time', '[5]/Time', '[6]/Time', '[7]/Time', '[8]/Time', '[9]/Time', '[10]/Time'")
Call Data.Root.ChannelGroups.Add("Channel group", 51).Activate()
Call ChnClpPaste(494)
Call Data.Move(Data.Root.ChannelGroups(51).Channels("Time"),Data.Root.ChannelGroups(51).Channels,1)
Call Data.Move(Data.Root.ChannelGroups(51).Channels("Time1"),Data.Root.ChannelGroups(51).Channels,2)
Call Data.Move(Data.Root.ChannelGroups(51).Channels("Time2"),Data.Root.ChannelGroups(51).Channels,3)
Call Data.Move(Data.Root.ChannelGroups(51).Channels("Time3"),Data.Root.ChannelGroups(51).Channels,4)
Call Data.Move(Data.Root.ChannelGroups(51).Channels("Time4"),Data.Root.ChannelGroups(51).Channels,5)
Call Data.Move(Data.Root.ChannelGroups(51).Channels("Time5"),Data.Root.ChannelGroups(51).Channels,6)
Call Data.Move(Data.Root.ChannelGroups(51).Channels("Time6"),Data.Root.ChannelGroups(51).Channels,7)
Call Data.Move(Data.Root.ChannelGroups(51).Channels("Time7"),Data.Root.ChannelGroups(51).Channels,8)
Call Data.Move(Data.Root.ChannelGroups(51).Channels("Time8"),Data.Root.ChannelGroups(51).Channels,9)

0 Kudos
Message 1 of 3
Accepted by topic author chisbae
12-05-2018 08:09 PM

Re: Script : object of filtered channel

Hi chisbae,


I'm not totally certain what you're after based on the wording of your post, but here is code that will copy all the "Time" channels to a new group.


Set NewGroup = Data.Root.ChannelGroups.Add("Channel group")
Set TimeChannels = Data.GetChannels("*/Time")
FOR Each Channel In TimeChannels
  Set NewChannel = NewGroup.Channels.AddChannel(Channel)

I actually doubt it's a good idea to create a channel group with just the time channels in it.  It's usually best to leave the time channel in the same group as the data channels that it describes.  Still, it's generally useful to know how to programmatically apply a filter expression to copy channels named a certain way to a new group you create.


Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 2 of 3

Re: Script : object of filtered channel

Hello Brad.

I resolved my problem using what you said. Thank you.
Originally, I want to make new group with found channels from another channel's data of channel's names.
It's sounds ridiculous. But, anyway, at this point, I can use what you introduced.

Target_name = Data.Root.ChannelGroups(1).Channels("Target List").Values(j)
Set TimeChannels = Data.GetChannels("*/"&Target_name) 

I resolved. Thanks.

0 Kudos
Message 3 of 3