Sort Sets

From HLKitWiki
Revision as of 01:24, 22 November 2008 by Rob (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Context: HL KitBasic Concepts and Terminology … Visual Building Blocks 

The Kit utilizes a "sort set" to appropriately sort the contents of a list of things or picks. Each sort set is essentially an independent sort specification. You can define any number of sort sets and they are not officially associated with any particular lists of objects. As such, you can easily re-use a particular sort set in a variety of situations.

The purpose of a sort set is to spell out the exact rules to be used for sorting a collection of picks or things. Each sort set will consist of one or more sort criteria, and those criteria must be specified in the exact sequence that you want HL to sort the items in.

Each sort criteria consists of a few characteristics. The first aspect is the unique id of either a tag group or a field. The second aspect is whether to sort the items in an increasing order or a decreasing order.

If a tag group is specified, then the sort criterion instructs HL to sequence all items based on the sequencing rules set forth for the tag group. All items that possess a tag from the tag group are sorted based on the tag group's sequencing rules, and any items that lack any tag from the sort group are sorted last.

If a field is specified, then the sort criterion tells HL to order the items based on the results of comparing the values of the designated field. The comparison rules use a simple numeric comparison when the field is a value and a string comparison when the field is text-based. If a particular item does not possess the field for some reason, then that item is always placed at the end of the sorted list.

When multiple sort criteria are specified, they are processed in the order given until one yields a difference, at which point all further sort criteria are ignored.

The starting data files provided by the Kit include a number of pre-defined sort sets. These sort sets provide an excellent starting point and are already used within the starting data files. You can readily revise and extend the set provided for your own needs.