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
mga123
From: EKCH, Denmark
Posts: 14
Hello there

Is it possible to add text as an output in a IF statement?

In the line for "transform" on the Sim Variable tab I am trying to add the text "STD" using this statement If(#=2,std,$). The result is not showed in my 7 segment display.
When using this staement instead; if(#=2,1111,$) things is working.

How is this done?

Kind regards
Morten
2022-01-25 20:19
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
Hi

Right Idea.... Wrong Section. and by the way the wrong Syntax !

In the Transform Field we "currently" can NOT use Strings ! This is blocked by MF in case we handle the Result for later optional Calculations to the next Place.....
So e.g. the Interpolation get struggle if the received Value is not a INT as expected.
We are still on testing this and plan to maybe allow this in a future release !

BUT

What you need is still posible in the COMPARE Tab....
This is technical like a UI based IF Statement.
There you can say IF Value = 1 THEN STD ELSE 123

You can also write Complex Formulas there if the one Graphical UI Statement is not enough
And HERE your Idea is working.....

NOTE: A String in a If Statment (Expression Syntax) is between Single Quotes 'xxx'
So your example would be if(#=2,'std',$)


**************
In case of the Compare Logic we mostly need a little "nested" Syntax if we need more then one possible Condition !

Lets say we like a Value .... 1 should be "Alpha" 2 should be "Bravo" 3 should be "Charly"
We will use Compare and say....
IF Value = 1
THEN Alpha
ELSE if($=2,'Bravo','Charly')

In theory you could also say...
IF Value >= 0 ( so always)
THEN if($=1,'Alpha',if($=2,'Bravo','Charly'))



I hope you understand...... Else ask here again or meet me at Discord ! So i can provide you the correct syntax for your project !
Also watch this tutorial.... There the situation is explaned.... https://youtu.be/DZuVu4qU9Uc?t=2153
Good Luck !
2022-01-25 21:24
Avatar
mga123
From: EKCH, Denmark
Posts: 14
Thanks

I did try to construct the IF statement in under Compare but it didnt work, but I used double quotes ", which may be the problem.

I try with sigle quotes and hope for a better result.

Kind regards

Morten
2022-01-26 12:23
icon