programmable relational database
with graphical user interface
Below documentation is part of the MUIbase dictribution and is also available in PDF.
For each table in your database you can specify in which order its records should be displayed. This chapter describes how you can specify an order and what consequences it has.
11.1 Empty Order
By default each newly created table has an empty order. This means that if you enter a new record, the created record is inserted at the current position, that is, behind the current record of the table. If you change some fields of a record, the position of the record within the table stays unchanged.
11.2 Order by Attributes
Sometimes it is useful to have the records sorted by a certain attribute, e.g. by the `Name' attribute if the table has one.
In MUIbase you can specify for each table a list of attributes by which its records should be sorted. All records are first sorted by the first attribute in this list. If two records are equal in an attribute then the next attribute in the list determines the order. For each attribute you can specify if the records should be sorted ascending or descending.
For determining the order of attributes the rules of the following table are used:
If you have specified an order for a table then the records are automatically rearranged whenever you add a new record or change an order-relevant field of a record.
11.3 Order by a Function
Sometimes you want a more complex ordering scheme than a simple attribute list as described in the last section. For example, an attribute list can't hold reference attributes, so it is not possible to sort your records by a reference field. The reason for this is that with reference attributes MUIbase is not able to keep your records ordered at all times (see Comparison function in the MUIbase programming chapter for more details).
However, MUIbase also offers the possibility to specify a comparison function for sorting your records. You can specify any function that you have written using the MUIbase program editor. The function will be called with two record pointers and the returned value should reflect the order of the two records. The function can use any operations for comparing the records, thus it can e.g. compare records using reference attributes. For more information on this mechanism, see Comparison function.
If you decide to use a comparison function for ordering a table then please note that MUIbase cannot always detect when records of the table have to be reordered since the dependencies are unknown. Use menu item `Table - Reorder all records' when records are becoming unsorted.
11.4 Changing Orders
To specify an order for the current table select menu item `Table - Change order'. This will open a window containing
For an order using an attribute list, the following items exist:
For an order using a comparison function, there is the following item:
Furthermore, the following buttons exist:
To enter a new attribute order list, choose `Attribute list' in the `Type' field and press the `Clear' button. Then use drag & drop as described above to build up a new list of attributes. If you want to have an empty order then just don't add any attributes to the order list.
When you are done specifying the order, press the `Ok' button. MUIbase will then reorder all records of the table.
11.5 Reorder all Records
If you ever think that some records of a table became unsorted, e.g. when using a comparison function for ordering, then you can choose menu item `Table - Reorder all records' for sorting all records.
This document was generated on September, 11 2016 using texi2html