Page 1 of 1

Expression to Convert a Boolean to a Number

Posted: Wed Sep 09, 2015 9:30 am
by Greg M
I was wondering if it's possible to use an expression on a Curve within a TrendViewer that would change a boolean dataSource value to 0 if it's false and 10 if it's true.

From what I have seen in the examples they seem to return only 0 or 1 unless using a System.Math function. Is it possible to create our own function and reference that in the expression?

Thanks in advance.

Re: Expression to Convert a Boolean to a Number

Posted: Wed Sep 16, 2015 8:53 am
by Greg M
I realised that I answered this question myself while typing the question!

I created a public static function in a script module then called this function in the expression, works perfectly.