DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

If less than...then Delete

I'm sure this is going to be a no brainer question, but unfortuately I don't have much time to teach myself VBS. 
 
I have a group with several channels that when the value in one channel is less than a certain value, I want that row and all the same rows in the other channels deleted.  I'm trying to use DataBlDel in conjunction with a For Each...Next Statement, but I honestly know very little about how to program in VBS and I've been beating myself with something that is probably very easy.
 
Thanks.
 
--claudia
0 Kudos
Message 1 of 5
(4,504 Views)

Hi Claudia,

Good to hear from you.  I would recommend using the Calculator programmatically to set the values from the control channel in those unwanted rows to NoValues.  Then you can use the ChnNoVHandle() function to remove all the rows from all the channels in that Group where the control channel has a NoValue.  You may actually find you'd rather set the rest of those rows to NoValues instead of deleting them, if what you really want to do is plot curves of event data

Group = 1
ControlCh = "[" & Group & "]/Revs"
L1 = CNo(ControlCh)
R1 = 5500 ' RPMs
Call FormulaCalc("Ch(L1):= Ch(L1) + NoValue*(Ch(L1)<R1)")
ChnStr = ""
FOR j = 1 TO GroupChnCount(Group)
  L2 = CNoXGet(Group, j)
  IF L2 <> L1 THEN ChnStr = ChnStrAdd(ChnStr, L2)
NEXT ' i
'Call ChnNoVHandle(ControlCh, ChnStr, "Delete", "X", 1, 0)

Ask if you have further questions,
Brad Turpin
DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 2 of 5
(4,481 Views)

Hi Claudia,

I created a working example of both the NoValue and Deleting options for you, attached below.

Brad

0 Kudos
Message 3 of 5
(4,478 Views)
Hey Brad!
 
Thanks so much!  I'm having lots of fun learning to use your code and adding to it.  I'm currently trying to figure out how to import a series of files without having to browse for a configuration file each time I want to load the file into DIAdem or export it into Excel.  I'm guessing there is a way to apply the configuration file to each file, but I thought that at least for importing I can use the DataPluggin Wizard (or so I think).  I'm messing with the DataPluggin right now, but only one of my columns is showing up... so thats where I'm at...
 
--claudia
0 Kudos
Message 4 of 5
(4,466 Views)
Hey Claudia,

I haven't had a ton of time to analyze Brad's code, but it seems to me that if you're trying to load multiple files you can simply repeat the method:

Call DataFileLoad(AutoActPath & "Example.TDM")

for every file that you need to load into the Data Portal.   Or perhaps I'm misunderstanding your question? 

Note that if you use this method of loading multiple files, you'll have to adjust Brad's code to iterate through every group when handling the Delete functionality of the VB Script.  I hope this helps!
Derrick S.
Product Manager
NI DIAdem
National Instruments
0 Kudos
Message 5 of 5
(4,422 Views)