DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Nesting formula

Hi,
 
I'm trying to use the following line within some script:

L1 = Find("Ch('[3]/Time')>(0.1-(0.9*(ChD(2,"[3]/Time")-ChD(1,"[3]/Time"))))",1)
However, it doesn't seem to like the use of the ChD function nested with the Find function, regardless of whether I use single or double quotes to frame the channel names within the ChD function. Is this not allowed within DIAdem? I can't find any reference in the help files about when to use single or double quotes.
 
I've used the following as a work-around:
 
R2 = chd(2,"[3]/Time")-chd(1,"[3]/Time")
L1 = Find("Ch('[3]/Time')>(0.1-(0.9*R2))",1)
 
Thanks,
 
Si.
0 Kudos
Message 1 of 2
(3,509 Views)
Hello Si!
 
DIAdem is evaluating the formula for every row in the channel. Therfore it analyse the formula. In your case this goes wrong (or is it a feature?). In general it is no good idea to put time consuming this in a formula. Your workaround is good, I prefer this solution:
L1 = Find("Ch('[3]/Time')>(0.1-(0.9*" & str(chd(2,"[3]/Time")-chd(1,"[3]/Time")) & " ))",1)
This will evaluate the compare value to a constant and add this to the formula.
 
Matthias
Matthias Alleweldt
Project Engineer / Projektingenieur
Twigeater?  
0 Kudos
Message 2 of 2
(3,483 Views)