Smart sorting examples
Simple numbering systems
Plane type Registration Mirage 2000C 03 Mirage 2000C 1 Mirage 2000-5F 44 Mirage 2000C 101 Mirage 2000N 304 Mirage 2000B 525 Mirage 2000D 632
Many military services use a simple numbering system, consisting of digits only. Sorting such a system may seem trivial at first, but it actually presents problems in common database systems as soon as leading zeros are used (which are often removed from the presentation), or when the serials are of differing length. In most database systems the serial must be stored as a string of characters (which means the serial 100 will be sorted before the serial 3), or as an actual number (which means leading zeros will be removed).
A good example of such a system is in use by the French Air Force for the Mirage 2000 (amongst others). Since each subtype has its own range of serials (and leading zeros are used for prototypes), the sorting becomes rather messy with Mirage 2000B, D and N models sorted between the C and -5 models.
These simple numbering systems are correctly sorted in this application by normalizing the registration to the actual number value. The sorting is performed on that number value, while in the presentation the original serial is still used. This means leading zeros are not removed and all numbers are placed where they should be.
Belgian military serials
Plane type Registration F-16A FA01 F-16A FA02 F-16A FA10 F-16A FA11 F-16A FA101 F-16A FA130 F-16B FB10
The Belgian military serial system consist of a type designator of one or two letters (with the second often denoting a sub type) and a sequence number. The sequence number usually runs from 1 up to as much as needed. The problem with sorting this system is the sequence number. Leading zeros are not used consistently, which often results in 1, 10 and 100 usually preceding the 2 and 20.
This application sorts the Belgian military serial system first on type designator and secondly on the sequence number. The example here demonstrates how a list of Belgian F-16s would be sorted, including A and B models.
Italian military serials
Plane type Registration AMX MM7157 AMX CSX7158 AMX-T MM55025 T-33A MM51-7534 T-33A MM52-9898 RT-33A MM53-5795
The Italian military serial system consists (most of the time) of 2 or three characters and a sequence number of up to 5 digits. The first characters usually are MM (for Matricola Militare, or military number, which is also used for other equipment besides planes), but prototypes and test planes can also use other prefixes (like MMX, CMX or CSX). When the aircraft is later put (back) into normal military service, the prefix is changed to MM.
Older equipment may also use other serial systems. Equipment bought through the FMS system from the Unites States often retained the original US Air Force serial, sometimes with the MM prefix, sometimes not.
Italian Military serials in this application are sorted by their sequence number, regardless of the prefix. USAF serials used as the sequence are sorted as a USAF serial (see below).
Portuguese military serials
Plane type Registration T-37C 2410 T-37C 02411 T-37C 2417 C-130H-30 6801 C-130H-30 16802 C-130H 6803
The Portuguese basically use the simple numbering system for their military serials. These days consisting of five digits, but it used to be less. A three digit system was introduced in 1937, replaced by a four digit system in 1951 which in turn was replaced by the current five digit system in 1994.
All planes in service with the Portuguese military at the time of the introduction of the five digit system were reserialled, with operational planes receiving a 1 before the serial and out of service planes receiving a 0. The 0 is not often actually painted on the aircraft, but the 1 certainly is used for all.
The problem with sorting Portuguese planes comes with the planes that were introduced before 1994 and were reserialled. These often fall out of range and therefore the whole sorting goes wrong. In this application the original and new serials (were applicable) are correctly interpreted and sorted together.
US Air Force serial system
Plane type Registration T-38A 68-8204 C-130E 68-10935 C-5A 69-0004 C-17A 92-3291 C-17A 99-0170 C-17A 00-0171
The US Air Force serial system uses a combination of a fiscal year (the last two digits of the year) and a sequence number. The sequence number is per year and not per type. This means that the sequence restarts every year and sorting should be done on year and then on sequence number.
This system gives two problems. In the first place the sequence number normally contains four digits. In some years however, the sequence runs into five digits. Since there is no leading zero if only four digits are used, the sorting gets distorted once a fifth digit is needed. Another problem surfaced with the turn of the century. Only the last two of the fiscal year are used in the serial, not all four, so fiscal year 2000 becomes 00 and is placed before all other values.
US Air Force serials (and countries that use the FMS serial, like France, Italy, Turkey, etc) in this application are sorted based on fiscal year (with paying respect to the real year, not only the last two digits) and correctly on sequence number, regardless of how many digits are used in the sequence number.
Japanse Air Self Defense Force serial system
Plane type Registration C-1 98-1029 C-1 08-1030 C-1 18-1031 T-4 06-5641 T-4 66-5747 T-4 16-5777
The Japanese Air Self Defense Force (the Japanese Air Force) uses a serial system that looks much like the previously mentioned US Air Force system, but is noticeably different. The presentation is similar, but it is constructed differently.
Each serial has a two digit prefix, followed by four digits. The very first digit denotes the year in which the plane was taken into service. Since only one digit is used, the same values are used every ten year. The second digit denotes the type, where each value is used for multiple types. The third digit (which is the first of the four digit main number) denotes what kind of role the plane is used for (like trainer, transport, jet, etc). Finally, the fourth to the sixth digits are the sequence number. This sequence number is per type and this should be the primary number to sort on.
Sorting Japanese Air Force serials obviously goes wrong due to the intricate system used. In fact, if the sequence number is taken as the main part to sort on, then just about all lists of serials look totally random. In this application the serials are sorted correctly, on the sequence number. The first three digits are in fact not taken into consideration for the sorting.
US civil registrations
Plane type Registration BD.700 N4T Ce.550 N4EK DC-8 N31CX DC-10 N211NW F.100 N1452B B757-200 N12109
US civil registrations are a combination of the national prefix (N), combined with 1 to 5 digits, followed by up to 2 characters. Together the registration can never be more than 5 digits and characters (plus the N prefix). Also, older aircraft may have an additional character following the N prefix, denoting the class of aircraft (like C for commercial). These extra class identifiers are no longer used since 1949, but some older planes may still carry it.
The mixture of digits and characters, as well as the optional extra character, makes for a very complicated sort list. In this application the sorting is performed first on the digits (as if it were a simple number) and then on the extra characters. For the characters a single character will always come before double characters. The extra class identifier is ignored for sorting.
Note that the example given here is as these registrations will be sorted in this application. In most other common database systems the list would appear in the exact opposite order!
Spanish military serials
Plane type Registration C.212 XT12-1 C.212B1 TR12A-3 C.212E1 TE12B-10 C.212A1 T12B-18 C.212AV1 T12C-43 C.212AB1 T12B-71
The Spanish military serial system is one of the most complicated systems to sort correctly. It uses a mixture of type designation and sequence number in each serial. Combined with several reregistrations and multiple type designators for the same main type (for example T.12 and D.3 for Casa 212s) makes for very strange sortings if done directly on the serial.
Each Spanish military serial is broken down into several parts to be able to find the sequence number and the main type. Sorting is then performed on main type first (omitting any sub type designators) and sequence number second. This allows for sorting all serials of one main type correctly, but also to sort a complete list of Spanish serials directly on the right order, taking into account the main types.
Note that most reregistrations are also taken into account. Helicopters for example were first registered with a Z character for the main type (Z.9 for the Sea Kings for example), which was later changed to H. Both old and new serials will be sorted within the same order.
- The above are examples of some well known serial systems. Other systems are sorted in similar fashion. However, not all systems might be provided for yet, nor will all future changes be automatically adapted. Please get in touch through the contact page if you come across a serial batch that does not sort correctly. Every effort will then be taken to make sure that batch will be sorted correctly as well.