DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

ChnAreaDel deleting wrong rows in a string channel

Solved!
Go to solution

I am trying to write a script in DIAdem 2010 SP1 to delete the first row of a group that contains two string channels and one time channel, but the

wrong data is being deleted from the string channels.

 

I start with a file that contains a group like this:

ExampleLog_Before

 

I run this code expecting the first row to be deleted

Dim logGroup
	Set logGroup = Data.Root.ChannelGroups("Log")

	Call ChnAreaDel(logGroup.Channels("Name"),1,1)
	Call ChnAreaDel(logGroup.Channels("ID"),1,1)
	Call ChnAreaDel(logGroup.Channels("Timestamp"),1,1)

but end up with this:

ExampleLog_After

 

The first row of the Timestamp channel is deleted, but the Name and ID channels get their last rows deleted.

 

I have played around a bit and it seems to me that for a string channel ChnAreaDel only deletes from the last row.

Is there another function I should use? 

 

Any help would be appreciated. 

 

Thank You,

Joe

 

0 Kudos
Message 1 of 3
(4,208 Views)
Solution
Accepted by topic author JFiddie

Hi Joe,

 

I've reproduced that ChnAreaDel()  bug you reported in both DIAdem 2010 and 2011-- really odd.  In the meantime, you can use this older approach that uses a string parameter to point to the channel collection to remove the row(s) from:

 

Set logGroup = Data.Root.ChannelGroups("Noise data results")
ChnStr = ""
FOR Each Channel In logGroup.Channels
  ChnStr = ChnStrAdd(ChnStr, Channel.Properties("Number").Value)
NEXT
Call DataBlDel(ChnStr, 1, 1)

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

Message 2 of 3
(4,191 Views)

Thank you Brad,

 

Your alternative worked like a charm.

 

I had came across the DataBlDel command in Help, but the last note says that you cannot perform block operations on text channels, so I didn't try it.

 

-Joe

0 Kudos
Message 3 of 3
(4,183 Views)