Expression to Convert a Boolean to a Number

A forum devoted to the discussion of all topics having to do with scripting and other advanced programming using iX Developer.
Post Reply
Greg M
Posts: 16
Joined: Tue Sep 08, 2015 1:32 pm

Expression to Convert a Boolean to a Number

Post 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.

Greg M
Posts: 16
Joined: Tue Sep 08, 2015 1:32 pm

Re: Expression to Convert a Boolean to a Number

Post 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.

Post Reply