DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Removing channels iteratively through for loop

Solved!
Go to solution

Hey all

 

I am trying to remove data channels from groups by iterating through a For loop.

 

This script loads multiple data files at once, and since I don't know how many files will be loaded at a specific time I want this to be a robust process.

 

Here is the script that I have tried:

 

for jj = 1 to X
for kk = 1 to noGroups
grName = data.Root.ChannelGroups(kk).Name
if grName = ("CUST"&str(X)) then
Call oElementList.Add(data.Root.ChannelGroups(grName).Channels("SampleTimeCoarse"))
Call oElementList.Add(Data.Root.ChannelGroups(grName).Channels("PacketCounter"))
Call oElementList.Add(Data.Root.ChannelGroups(grName).Channels("Pitch"))
Call oElementList.Add(Data.Root.ChannelGroups(grName).Channels("Roll"))
end if
next
Data.Remove(oElementList)
next

 

Here is a screengrab of what I want the group to finally look like (CUST) and what it looks like prior to the channels being removed (CUST1 through X):

 

HRA_Brian_2-1619016472421.png

 

 

Thank you for any help and advice!

 

0 Kudos
Message 1 of 2
(926 Views)
Solution
Accepted by topic author HRA_Brian

Solved it:

 

for jj = 1 to X
rmGroup = "CUST"&str(jj) <-- added variable
for kk = 1 to noGroups
grName = data.Root.ChannelGroups(kk).Name
msgboxdisp(grName)
msgboxdisp(rmGroup)
if grName = rmGroup then
Call oElementList.Add(data.Root.ChannelGroups(grName).Channels("SampleTimeCoarse"))
Call oElementList.Add(Data.Root.ChannelGroups(grName).Channels("PacketCounter"))
Call oElementList.Add(Data.Root.ChannelGroups(grName).Channels("Pitch"))
Call oElementList.Add(Data.Root.ChannelGroups(grName).Channels("Roll"))
end if
next
Data.Remove(oElementList)
next
0 Kudos
Message 2 of 2
(904 Views)