03-25-2019 01:54 AM
Hi KrzyFul2,
It seems that in DIAdem 2012 sometimes the "for each " doesn't assign the channel object (aChnl) correct.
I fixed this with the command ChnCharacter(). And I saw that the quotation marks in Find and FindReverse were uncomplete.
dim dLimit, iStartPos, iStopPos, aChnl, aGroup
For Each aGRoup In Data.Root.ChannelGroups
For Each aChnl In aGroup.Channels
call ChnCharacter(aChnl)
R1 = aChnl.Properties("maximum").Value * 0.05
iStartPos = find("ch(""" & aChnl.GetReference(ExtendChnName) & """) > R1")
iStopPos = FindReverse("ch(""" & aChnl.GetReference(ExtendChnName) & """) > R1" )
call DataBlDel(aChnl.GetReference(ExtendChnName), 1, iStartPos)
aChnl.Properties("length").Value = iStopPos - iStartPos
Call aChnl.Properties.Add("To_Process", "Yes", DataTypeString)
Next
Next
Please keep in mind, that the command ChnCharacter takes a bit time. I tested this code without ChnCaracter in DIAdem 2018 without problems. So ChnCharacter is only a workaround as long as you work with 2012.
Greetings
Walter