Smart sorting

Problem of sorting registrations

Correctly sorting aircraft registrations and serials is not possible in most automated systems. The reason behind this is that computer systems normally sort values character by character. The decision to place one value before or after another is taken by simply looking at each character and the first character in which the two values are not alike will determine which value comes first. This however, does not take into account the system that is behind the registration or serial. In order to correctly sort these kind of values the values need to be broken down into parts and the sorting needs to be done based on those parts.

One of the best examples to demonstrate the problem is the Spanish Air Force serial system, in particular Casa 212 serials. The Spanish Air Force uses a system where each registration consist of a type designator and a sequence number. The type designator uses a combination of letters and numbers, the sequence number is only a number.

Aircraft type Serial Type designator Sequence number
Beech F33C E.24A-7 E.24A 7
KC-130H TK.10-06 TK.10 06
Casa 101 XE.25-01 XE.25 01
Casa 212B1 TR.12A-3 TR.12A 3

The ordering should be done primarily on the sequence number. This number defines the order within a type range. However, because computers normally begin sorting from the beginning, the real sorting is most of the time determined by the type designator. And as can be seen by the example above, that type designator can provide even more issues, due to the mixed meaning of the character. In the case of the above Casa 101, the real type designator is E.25, the X just denotes it is a prototype. In the case of the Casa 212 and KC-130, the real type designator is T.10 and T.12 respectively. The K and R denote suptypes.

In the end, a series of Spanish Air Force C.212s are sorted as follows. Recall that sorting should be done on the sequence number!


The sequence in which Spanish C.212s are most often sorted

The correct way of sorting these records would be as follows however, which is the way the records are sorted in this database:


Correct way of sorting Spanish C.212s

Note that in this case also the serials without the . (dot) in the type designator are correctly sorted within the range.

This problem is not just related to complex serial systems like the Spanish Air Force system. The most basic of system has this issue. A simple sequence number from 1 to 100 for example, will see the 2 only after 100,11,12,...,19. The reason is the same again, the computer will sort the characters one by one and the 2 comes after the 1. In systems like this (where registrations are stored as text, not as numbers) the computer will not know that 19 is bigger than 2.

Automatic correct sorting

This application has a build in system to correctly sort the most diverse range of worldwide registration and serial systems. Whenever a new log entry is made the registration or serial will be interpreted and a normalized version of it will be stored on which future sorting will be performed. This ensures correct sorting for most known systems, without any performance loss when the actual records are sorted.

In most cases the registration or serial can be entered without specific constraints (like using the . in a Spanish serial as seen above). There are some points to consider however, which are outlined below.

See examples of correctly sorted serial systems in the examples page.

Important fields

The way the registration or serial is interpreted depends on three fields (see: help/fields):

Most serial systems are country and service dependent (like the US Navy system is not the same as the US Air Force system) and in some cases differences exist between specific types. In France for example a relatively simple system is used for most types, but some irregularities exist for specific types (the C-160 for one has had the F- serials reregistered to R- serials, but the sequence number remained the same).

These three fields will need to be entered correctly in order to have the registration or serial interpreted correctly. Country and service values can only be selected from preset lists, but a custom value may be set for the main type field. If that is the case and if the correct interpretation depends on the main type value, than those registrations or serials might not be sorted correctly. It is therefore advised to always use the predefined main type values from the pick list, where possible.

Valid input

There is no input check done on the registration field, this field is free format. For smart sorting to work there is no specific restriction on the field, in fact many special characters in the serials are optional and can be used, or left out. Some examples:

Serial system Character Example Usage
All Upper and lower case PH-BXG or ph-bxg Both upper case and lower case letters can be used at anytime. All characters will be used in upper case for the interpretation, but this will not affect the actual registration or serial entered.
Dutch Air Force - J-202 or J202 The - in the serial is optional. It may be used, may be left out, or may be replaced by a space character. This will not effect the sorting. All representations may be used at the same time.
German Air Force + 30+10 or 3010 The German roundle is in the middle of the serial presentation and is often quoted with the serial. This can be done and will not affect the sorting. Both representations may be used at the same time.
Spanish Air Force . TR.12A-3 or TR12A-3 Spanish serials are sometimes seen with the . (dot) and sometimes without it. Both representations may be used at the same time.
Italian Air Force . M.M.7483 or MM7483 Italian serials can be entered with or without the . (dot) in the serial. Both representations may be used at the same time.

Sorting on registration across multiple countries, services or types

The smart sorting mechanism is specifically designed to work within the context of the country and service it interprets the registrations and serials for. The specific value that will be sorted on therefore, might not be applicable when the record set sorted on is expanded beyond that context.

For example, if a filter is created that selects all planes from the database and only sorts on the registration field, then some of the planes may in fact seem to be sorted in an unexplicable manner. This occurs due to the fact that the value actually being sorted on is structured to the specific serial system. Values from other serial systems will have a different structure, even though the actual registration or serial might even be equal.

When creating a filter with a sort rule on the registration field, it is advised to always include either a select rule on country and service, or include sort rules on country and service before the sort rule on registration. (see: help/filters)