Conditional Expressions

Want to filter out various Aircraft on the Chart or Aircraft List.
Graham Tanner has very kindly put some Conditional Expressions together to help you understand the process.


Conditional Expressions.

how to *not* show flights from a particular airline or operator

flt != "BAW%"
flt != "BAW%" or flt != "EZY%"

how to only show certain aircraft types.

typ = "B74%"
typ = "A32%" or typ = "A38%"

how to show only those close to you (make sure your Home Location is accurate!)

range < 20

how to show only those close to you and below a certain height.

range < 20 and alt < 5001

how to show those landing at a particular airport (only works if Flightroute is enabled).

route = "%-EGLL" or route = "%-LHR"

how to show those taking-off from a particular airport (only works if Flightroute is enabled).

route = "EGLL-%" or route = "LHR-%"

how to show only helicopters (must have previously set all helicopters to user-tag '$7' using SQL).

tag = "$7"

how to show anything 'near' Heathrow.

(lat > 51.45 & lat < 51.49) and (lon < -0.41 & lon > -0.49)

(note: this will show aircraft at any height - low-level and probably inbound/outbound, and high-level on airways, plus

aircraft crossing at low-level but not to/from Heathrow)If you want to display just aircraft 'near Heathrow' that are landing or taking-off you will need to add to the CondEx to limit it to aircraft under 4000 feet (or some other number)

(lat > 51.4 and lat < 51.6 and lon < 0.64 and lon > 0.2) and (alt < 4000)

In this particular instance the brackets are not strictly necessary, but they help to clarify the CondEx. With this CondEx both conditions in the brackets must be true for the aircraft to be displayed ... the first one in brackets show that *all* those conditions must be true at the same time (ie, the aircraft is 'near Heathrow'), and the second one means that only aircraft below 4000 ft will be displayed.

- very easy to set-up and use;
- very handy for 'days-out' at an airport and you're only interested in what's arriving or departing;
- using the 'lat' and 'lon' fields in a CondEx you can only define a square or oblong area of space, you can't define a diamond or triangle! If your local airport has a 'diagonal' runway system (eg Manchester or Birmingham) you still have to define a square/oblong;

How to show just military aircraft.
This is, by far, the most common question about CondExs that I am ever asked. About 80% of the questions relate to this, butunfortunately the answer is not so simple.

There are a number of different ways of tackling the question; some require extra work in other parts of the system, some need complex CondExs, and some only work for a short time.

Firstly, there is no flag or setting in the Basestation.sqb database which identifies and aircraft as being operated by the military, so there is no solution there.
Secondly, you cannot identify military aircraft purely upon their aircraft type - there are military B.747s, AS.350 helicopters, Beechjet 400s, King Air 200s - so if you set-up a CondEx covering these types (and many more) you will see all
the civil ones as well as the military ones.
You will almost certainly miss out various military types in your CondEx, meaning that you won't see them on your Chart or Outline.
Thirdly, there is no such field as 'operator' in the Conditional Expressions system, so you cannot create a CondEx based upon that. (Note: there *is* a field in the Basestation.sqb database which holds such a value, but it is not testable in a CondEx).

Solution #1
set-up a CondEx which makes PP only display certain aircraft types ...

typ = "DC10" or typ = "C17" or typ = "C5%" or typ = "F15" or typ = "EUFI" or typ = "L101" or typ = "K35R" or typ = "TORN" or typ = "F16" or typ = "TUCA" ..... and so on

- only shows the military aircraft types that you are interest in;
- relatively easy to create the CondEx;
- only a CondEx, no changes required elsewhere in the PP system;
- create the CondEx, and once correct you (probably) don't need to change it again;
- you *will* miss out some aircraft types, so they will never appear on your screen, so you probably won't even know they're issing;
- there are many types which are used by both military and civil operators (B.737s, A.320, DC-10 etc), so if you include them n your CondEx you will see all the civil ones, but if you do not include them you won't see the military ones;

Solution #2
identify military aircraft in the Basestation sqb database file, and change a value so that it can be tested in a CondEx.Use SQLite to identify the military aircraft that you are interested in, and set the 'Interested' flag to 'true'; then, in PP
under the 'View' menu item click on 'Chart display options' and then click on 'Chart 'interested' - i'.
- very elegant solution and easy to implement;
- can use this method to show 'military only' plus other things of interest (say, A.380s?);
- setting the 'Interested' flag to 'true' means that PP shows these aircraft in a bold font, making them stand out more on the screen.
- every time you update the Basestation.sqb database file (every month?) you *must* re-run the 'update SQL' statement,
otherwise any new military aircraft added that month will not display;
- how to be certain that you have identified all the military aircraft in the Basestation.sqb database;

Solution #3
This is a combination of the above two, with a slight variation on the second one.

Use SQLite to update all 'Interested' flag to 'true' where the ModeSCountry contains "%Mil". There are still a handful of entries in the database for aircraft which are obviously Military, but their ModeSCountry is incorrect; it might be worth
looking for these and correcting them before you run the Update SQL.Set-up a CondEx so that PP *does not* display aircraft belonging to certain airlines (based upon their Flight Number) - and make sure that you cover as many airlines as possible!

flt != "BAW%" & flt != "ACA%" & flt != "BMI%" & reg != "EI%" & flt != "AFR%" & flt != "SAS%" & flt != "SHT%" & flt != "BMA%" & flt != "KLM%" & flt != "IBE%" & flt != "AAL%" & flt != "UAL%" & flt != "AZA%" & flt != "BEE%" & flt != "BC%" & flt != "DAL%" & flt != "QTR%" & flt != "WZZ%" & flt != "AWE%"

and then extend this to various aircraft types

& typ != "A321" & typ != "C152" & typ != "C172" & typ != "G115" & typ != "AT%" & typ != "DH8%" & typ != "P28%"

and then extend it further to include various registration prefixes

& reg != "M-%" & reg != "F-%" & reg != "C-%" & reg != "D-%" & reg != "OO-%" & reg != "OE-%" & reg != "9H%" & reg != "LX%" & reg != "HB-%" & reg != "PH-%" & reg != "LN-%" & reg != "OH-%" & reg != "CS-%" & reg != "OY-%" & reg != "EC-%" & reg != "TC-%"

- relies upon the Flight Number being transmitted by the aircraft, which might be incorrect (eg 'UA' instead of 'UAL');
- displays all military aircraft in a bold font, and ones that are new to you (or have not been updated in your database) will be in normal font;
- can be easily extended to include more airlines, or aircraft types, or reg prefixes;

- still relies on you running the SQL Update every time the Basestation.sqb database is updated;
- still shows quite a few 'non-Mil' such as biz-jets and less-common reg prefixes;