DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

ChnEventFind could not find timestamp

I have a timestamp channel as

oGrp.Channels("CorrectedDateTime")

I would like to find index where the timestamp is larger than "06/01/2017" and remove data of all channels at index before this timestamps I can successfully use ChnFind to and DataBlDel to do it as:

 

index = ChnFind("ValEqualGT(A,B)", 1, array("A", "B"), array(oGrp.Channels("CorrectedDateTime"), CDate("06/01/2017")))
Call DataBlDel(oGrp.Channels,1,index-1)

However, it takes long for ChnFind function to find the index.

 

 

Is it possible to use ChnEventFind to achieve same result? Here is what I tried but the ChnEventDuration gave 0.

ChnEventResultList = ChnEventFind("(A > B)", array("A","B"),array(Data.GetChannel("[1]/CorrectedDateTime"), CDate("06/01/2017")))
msgbox(ChnEventDuration(ChnEventResultList))

Also, in ChnEventFind, why did it fail when I use oGrp.Channels("CorrectedDateTime") instead of Data.GetChannel("[1]/CorrectedDateTime") ?

Thanks

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

Hey,

 

Your ChnFind seems overly complicated just for finding an index. Maybe you can try something like this ?

 

dim i

i = PNo(Data.Root.ChannelGroups(1).Channels("Date"), CDate("04/27/2006"))
Call DataBlDel(Data.Root.ChannelGroups(1).Channels("Date"), 1, i - 1)
Call DataBlDel(Data.Root.ChannelGroups(1).Channels("Serial number"), 1, i - 1)

That's just an example, there are a lot of different ways to get the index in your case 🙂

 

The PNo function doc : http://zone.ni.com/reference/en-XX/help/370858M-01/functions/functions/pno/

CLAMaxime -- Kudos are a great way to say thank you
0 Kudos
Message 2 of 2
(2,321 Views)