Collation – sorting like clockwork

Sorting character strings alphabetically is an effective way of quickly finding the element you are looking for in a list. The sorting of character strings plays an important role, especially in software solutions with large amounts of data.

To do this, the elements must be placed in the correct collation. But which collation is the right one?

In this article, I would like to answer this question and introduce you to a way of stringing together strings within conzept 16.

Alphabets

Depending on the country and language, different rules are defined for the correct sorting sequence for alphabetical sorting. Most Western languages are based on the Latin alphabet with the 26 letters A to Z. Other letters are then added – often with diacritical marks – such as umlauts.

The German alphabet also contains the umlauts Ä, Ö and Ü as well as the ß (Eszett). These are sorted alphabetically according to their base characters, i.e. Ä, Ö and Ü with A, O and U and ß with S.

Character sets

In software, these different alphabets are combined in character sets. For example, the character set “Windows-1252” (Windows code page 1252) contains the letters required for most Western languages. In addition to German, this also includes French, Portuguese and Swedish, for example.

The Unicode character set, on the other hand, contains all the letters of most living languages.

Sorting sequence

Within the character sets, the letters are not sorted alphabetically. This means that for a correct alphabetical sorting, the alphabet of the character set must be put in a different order depending on the country and language in order to obtain a correct sorting.

A selection of practical collation sequences can be found on the page collation-charts.org. Tables are listed there for various software solutions and languages that describe the sort sequence used. For example, the sort sequence for the German Windows Vista.

conzept 16

In concept 16, sorting can be implemented using a table key or the container elements CteTree and CteNode, for example. However, the character strings are sorted according to the alphabet of the character set and not according to a country- or language-specific alphabet:

  • Franca
  • Franz
  • François (ç to z)
  • Jakob
  • Julia
  • Jákup (á to u)
  • Raul
  • Ray
  • Raúl (ú to y)
  • Zoe
  • Zofia
  • Zoë (ë to f)

This would be a possible correct order for the German language:

  • Franca
  • François (ç to c)
  • Franz
  • Jakob
  • Jákup (á to a)
  • Julia
  • Raul
  • Raúl (ú to u)
  • Ray
  • Zoe
  • Zoë (ë to e)
  • Zofia

To achieve this sorting sequence, the character string must be converted into a sortable form. The letters must be assigned their position in the sorted alphabet.

The Str.Collate() function – which you can download at the end of the article – does exactly that.

Example

// Load sort sequence for Germany
Str.CollationLoad(_Str.Collation_deDE);

tCteTree # CteOpen(_CteTree);

tCteTree->CteInsertItem(Str.Collate('Franca'), 0, 'Franca');
tCteTree->CteInsertItem(Str.Collate('François'), 0, 'François');
tCteTree->CteInsertItem(Str.Collate('Franz'), 0, 'Franz');

...

// Unload sort sequence
Str.CollationUnload();

The passed alphabet is loaded in the Str.CollationLoad() function. A collation sequence is generated from all 255 different characters of the conzept 16 internal character set – which contains all characters of Windows code page 1252. You can easily extend this function with additional sorting sequences. The sorting sequence is used in function Str.Collate() to convert the character string into a sortable form. Function Str.CollateUnload() is used to release a loaded sort alphabet again.

Conclusion

You can use this function to sort character strings in conzept 16 according to any alphabet. You can save the resulting sort values in a key field of a table or a container element, for example.

Although this option is not a native solution, it offers the possibility of being expanded and adapted to your own needs.

Download

Zum downloaden hier klicken SysStrCollate.prc (5.28 KB)
Sie müssen angemeldet sein, um die Datei herunterladen zu können.

Klicken Sie hier, um die Nutzungsbedingungen für unseren Blog zu lesen.

Leave a Reply

Your email address will not be published. Required fields are marked *

Leave the field below empty!

Requests, questions or feedback are welcome:

Terms of use of the comment function in the blog

1. General information

Vectorsoft AG (‘Provider’) provides a public blog for Internet users (‘Users’) on the vectorsoft.de website. The public blog is intended for the exchange of information and ideas. Users who participate with contributions and comments undertake to comply with the blog terms of use and are responsible for the accuracy, appropriateness and freedom from legal infringements of their contributions. By using the comment function in our blog, you accept these terms of use.

2. Netiquette

We ask you to refrain from personal attacks and provocations based on other opinions. Please argue objectively and maintain a constructive discussion culture. Your comment should always be related to the topic in question in order to avoid digressions into other topics. Posting the same comment or several similar comments more than once is not permitted.

3. Prohibition of illegal content

By submitting your comment, you confirm that you are not violating any copyrights or other rights of third parties. Inciting, racist statements, instructions for criminal offences and their glorification, depictions of violence, pornographic content and statements that violate personal rights are prohibited.

4. No advertising

The use of the comment function is not permitted for commercial or party-political purposes. Advertising contributions of any kind will be deleted immediately.

5. Details of the name

When entering your name, pay attention to the principles mentioned above.

6. Source references

If you intend to publish quotes or contributions from third parties, please indicate the respective sources and explain how they relate to the blog post.

7. Violation of the terms of use

Posts that violate this policy will be deleted immediately. If you notice any violations yourself, please send us the link to the comment in question by e-mail to . We expressly point out that we will exclude individual users in the event of repeated or serious violations of these terms of use.

As of: Sept. 2024

Get your Trial Version now!

Test yeet free of charge

IHRE EVALUIERUNGSLIZENZ - JETZT ANFORDERN!

TESTEN SIE DIE CONZEPT 16 VOLLVERSION - UNVERBINDLICH und KOSTENFREI

Subscribe to our newsletter

[cleverreach_signup]
WordPress Cookie Notice by Real Cookie Banner