Page 1 of 1

A question about expression

Posted: 02 Feb 2014 21:28
by rsegoly
If I get this message from nma as broadcast, how do i refer to it in condition expression? Since the number value will change from time to time


Its above threshold:
933

Re: A question about expression

Posted: 03 Feb 2014 17:43
by Martin
You can extract the number in the message in different ways and compare the value. Something like this should work in a condition Expression:

Code: Select all

//simulate nma message
m = "Its above threshold:\n933";

//find the index of the first colon
i = indexOf(m, ":");

//extract the value (position of the colon + 2 to skip the colon and the newline characters)
value = substring(m, i + 2);

//test whether or not the value is bigger than 900
//determines whether the condition is true/false since it is the last statement in the condition
val>900;

Re: A question about expression

Posted: 03 Feb 2014 17:46
by rsegoly
Thanks, as I also initiate the message I found it was easier just to send the number