11-02-2017 05:07 PM
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,
11-06-2017 04:08 PM
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?
11-09-2017 05:21 PM
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