DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

delete rows in a string channel

Hi, I have a string channel. If the string channel row value doesn't match the expected string, I want to delete this row. I don't know the row number until the not match string is detected.

 

iloop is the row number I loop through. For example, iloop can be 1,2,3..

Here is the expression I use,

  Set oMyAssgnList = Data.GetChannels("[1]/"&cstr(CNoXGet(1,3*iloop-1)))
  Call Data.Remove(oMyAssgnList)

Data.GetChannels("[1]/"&cstr(CNoXGet(1,3*iloop-1))) doesn't work.

Is there a way to make this work?

Thanks,

0 Kudos
Message 1 of 3
(2,536 Views)

Hi llx,

 

Could you give a bit more context on how you're detecting the match/not match?

 

Natural first question: does cstr(CNoXGet(1,3*iloop-1)) return what you're expecting it to?

William R.
0 Kudos
Message 2 of 3
(2,491 Views)

Hi IIx,

 

You're using the wrong commands for the task you're describing.  The CNoXGet() command returns the channel number (index) of the whole channel.  Your "iloop" variables used in the argument of CNoXGet() is actually looping through the channel arrays (columns) not their values (rows).  Similarly, the Data.GetChannels() command retrieves a list of channels and the Data.Remove you're using deletes entire channels.  At no point in your code are you ever looking inside a channel to read our a particular row value of that channel.

 

Here is code that performs the comparisons and removals that you describe with your words:

Set Channel = Data.GetChannel("[1]/[1]")
iMax = Channel.Size
FOR i = iMax TO 1 Step -1
  IF Channel(i) <> "OK" THEN Call ChnAreaDel(Channel, i, 1)
NEXT ' i

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 3 of 3
(2,477 Views)