Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Using Case Statements

Featured Replies

I need some help with using " Case " statements in XML. I can find plenty of code that is used for displaying bitmap images, like Sample 1. I have not been able to use "Case statements" for any other purpose. I would like to know if it can be used to display "TEXT", like Sample 2. and can it also be used to display "Parameters" like Sample 3 ? greenco**************************************************************Sample 1(A:Flaps handle index,number) *****************************************************************Sample 2(A:Flaps handle index,number)Flaps UpFlaps NeutralFlaps Down ***************************************************************** Sample 3(A:Number of Engines, number)%((A:RECIP ENG1 FUEL FLOW, pounds per hour))%!5.2f!%((A:RECIP ENG2 FUEL FLOW, pounds per hour))%!5.2f!%((A:RECIP ENG3 FUEL FLOW, pounds per hour))%!5.2f!

Hi ???,Two examples from my gauges:To display a string with a case:%('FULL' '20' '10' 'UP' 4 (A:FLAPS HANDLE INDEX,number) case )%!s! To use a case in a clickspot tooltip:GPWS State (%('Off' 'Temporarily Suspended' 'On' 'Test' ' ' 5 (G:Var1) case )%!s!)Cheers, Rob Barendregt

Thanks, but that is not what I was after. Is it possible to do something like this? This code is just an example and it does nothing, other than to demostrate what I want to do. I want to get a value (a number) from a parameter and depending upon what that number is, I want to display the contents of another parameter, in a gauge.(A:Number of Engines, number)%((A:RECIP ENG1 FUEL FLOW, pounds perhour))%!5.2f!%((A:RECIP ENG2 FUEL FLOW, pounds perhour))%!5.2f!%((A:RECIP ENG3 FUEL FLOW, pounds perhour))%!5.2f!greenco

According to the DTD, and your and my experience, the tag only works for images.The expression parser does have a case operator, as shown in Rob's sample, and there is a different {case} structure that can be used inside s. I'd use that one in your case; there's some examples in the beech_baron. I'd whip up an example, but I'd get it wrong, so I'll leave that to the experts here.Douglas

There are two ways to display s dependant on some parameter. The first would be to write 4 nearly identical containing the full formats controlled by .. Too much writing. The second way follows. Controlled by (L:EngineDisplay, number).. 0=off, 1= ENG1, 2=ENG2, etc.. %((L:EngineDisplay, number))%{case}%{:1}%((A:RECIP ENG1 FUEL FLOW, pounds per hour))%!5.2f!%{:2}%((A:RECIP ENG2 FUEL FLOW, pounds per hour))%!5.2f!%{:3}%((A:RECIP ENG3 FUEL FLOW, pounds per hour))%!5.2f!%{:4}%((A:RECIP ENG4 FUEL FLOW, pounds per hour))%!5.2f!%{end}%Robs post shows how to change "fixed" items ( The above could work too ) donot know if his version would switch between variables, haven't tried.Regards,Roman(KGRB)

20AUG21_Avsim_Sig.png?dl=1  FS RTWR   SHRS F-111   JoinFS   Little Navmap 
 

 

Thanks RomanI can use your code to make it do what I was wanting. I gather that your code is another method to get around writing a lot of IF..ELSE statements. I have filed it away in my XML folder, for future use.Thanks againgreenco

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.