DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

If - or

Hi!

 

I've got a little problem with the following code:

 

Dim i

For i=GroupChnCount(1) to 1 step-1
If ChnName(i)<>"Time" or ChnName(i)<>"AudioTime" Then
Call ChnDel(i)
End if
Next

 I want to delete every Channel except of "Time" and "AudioTime". Unfortunately diadem deletes every channel.

 

When I choose just one of the channel names, the code works.

 

Thank you!

0 Kudos
Message 1 of 2
(2,863 Views)

Please use the object interface instead

Option Explicit

dim grpO : set grpO = data.Root.ChannelGroups(1)
dim i : For i = grpO.Channels.Count to 1 step-1
  if grpO.Channels(i).Name <>"Time" and grpO.Channels(i).Name<>"AudioTime" Then
    call grpO.Channels.Remove(i)
  end if
Next

The even better soltion is to avoid loading the channels at all using reduced loading

Call DataFileLoadSel("C:\temp\Data.tdm","TDM","[1]/Time|[1]/AudioTime", "Load")

 

P.S.: The reason why all channels are deleted is because of the

or

The expression will always be true because a channel can't have both names.

It needs to be an

and
0 Kudos
Message 2 of 2
(2,823 Views)