MobiFlight Community Support

Welcome to the forum for MobiFlight! Feel free to reach out to the community in case you have questions, issues or just want to share great ideas or details about your latest home cockpit project.

You like MobiFlight? Donate via PayPal and support the MobiFlight development. Thanks! 

05/03/2024 - This forum is read-only

The community support for MobiFlight has moved exclusively over to our Discord server. Register for free and enjoy more interactive functions like image and video upload, voice chat. More than 7,000 registered users around the world make it a great experience!

See you on our MobiFlight Community Discord server.

A HUGE Thank You to everyone who participated in the forum, especially obviously to Pizman and Stephan who did an outstanding job over so many years providing an incredible service to the MobiFlight community.

The forum is still providing a lot of good content, hence we keep this information accessible.

icon
Avatar
whQQps
Posts: 4
hi,
I want to show magnetos status at lcd display.
when I use below formula in transform field it's working. But second formula with text (OFF, RIGHT etc) is not working. Expression syntax page says "Strings are also possible" and gives third formula. so is this a bug?

if($=0,0,if($=1,1,if($=2,2,if($=3,3,if($=4,4,999)))))

if($=0,'OFF',if($=1,'RIGHT',if($=2,'LEFT',if($=3,'BOTH',if($=4,'START',999)))))


https://www.mobiflight.com/en/tutorials/community-guides/expression-syntax-guide.html
If a value is greater than 10000 then 1 else 0
if($>10000,1,0)
Strings are also possible
if($<=10000, ‘LL_ON’,’LL_OFF’)
2022-06-15 15:55
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
Hi.

Your on the right way.... But on the wrong spot.

At first....
I hope the first Line
iconQuote:

if($=0,0,if($=1,1,if($=2,2,if($=3,3,if($=4,4,999)))))


was just a example.... Cause its way to difficult .... 0=0...1=1....2=2....3=3....4=4 ... All else is 999
here if($<5,$,999) do the same.

About String Problem....

In TRANSFORM we currently not allow String Entrys . Its still conflicting with the internal "handoff" of this value to the later elements like Compare, Interpolation and also e.g. a Motor.
A Transform always execute a Integer .... So result can not be a String. Floats are truncate to integers also.

Solution:
In COMPARE Strings are allowed.... Simply use your code line in the Compare Tab.
E.g. in the THEN field.... And in the IF you define something that is always true.... E.g. IF Value >=0
So the THEN will be executed at all time ..... And do what you need .... if($=0,'OFF',if($=1,'RIGHT',if($=2,'LEFT',if($=3,'BOTH',if($=4,'START',999)))))
Good Luck !
2022-06-15 19:10
Avatar
whQQps
Posts: 4
thank you :) problem solved :) :thumbup: :thumbup:

and yes, first line was an example for testing purpose.
[Last edited by whQQps, 2022-06-15 20:18]
2022-06-15 20:10
icon