02-13-2023 11:58 PM
Hello all,
I have a channel like follow
Content Time Value
1 0.1 15
2 0.2 20
3 0.3 30
4 0.4 40
I used formula t1= chnfind("Ch(""I"")>20") and return me value "3" from Content area. How can I use chnfind function, or another function to return Time value ? In this example to return me "0.3"?
Thank you!
PS. I`m using DIadem 2021
02-14-2023 01:11 AM
Hi Alex_SI,
ChnFind returns the row where the condition is true for the first time. This can be used to get channel content of other channels. Here is a more formalized example for this request.
dim oSourceChn, oSearchChn, iIndex
set oSourceChn = Data.GetChannel("[1]/Speed")
set oSearchChn = Data.GetChannel("[1]/Time")
dim sFormula, aSymbol(2), aValues(2)
sFormula = "A >= B"
aSymbol(1) = "A"
aSymbol(2) = "B"
Set aValues(1) = oSourceChn
aValues(2) = 30
iIndex = ChnFind(sFormula, 1, aSymbol, aValues)
if iIndex > 0 then
msgbox oSearchChn(iIndex)
end if
Greetings
Walter
02-14-2023 01:32 AM
Thank you, if I will formula "divede by 10" (10 is samplerate) to get Time Value it will be OK? What do you think?
02-14-2023 01:42 AM
I am not sure what exactly mean, but you can of course extend the formula:
dim sFormula, aSymbol(3), aValues(3)
sFormula = "A >= B / C"
aSymbol(1) = "A"
aSymbol(2) = "B"
aSymbol(3) = "C"
Set aValues(1) = oSourceChn
aValues(2) = 30
aValues(3) = 10
Greetings
Walter