Sorting rules – the order in which a lookup offers its values¶
Sorting rules are part of a lookup validation rule. They decide the order in which the rule offers the records of the lookup entity for selection. This page describes their settings and behaviour. It is intended for administrators who configure business rules.
1. At a glance¶
| Purpose | Orders the options of a lookup validation rule |
| Typical use | Alphabetical by name, by a sort number maintained in the lookup entity, newest first |
| Related | Lookup validation rule, Population rules |
Sorting rules are edited on the tab "Sorting" of a lookup validation rule. A list validation rule needs none: it offers its values in the order you entered them.
2. Settings¶
On the tab "Sorting", the + adds a sorting rule. Per rule, buttons remove it or move it up or down.
| Setting | Meaning | Default / required |
|---|---|---|
| "Field" | A field of the lookup entity to sort by. It does not have to be the field that is shown. | required – a rule without a field is skipped |
| "Direction" | Ascending (A to Z, oldest date first) or Descending (Z to A, newest date first) |
Ascending |
3. Behaviour¶
- The sorting rules are applied from top to bottom: the second rule decides only between options that are equal in the first one.
- They apply wherever the rule offers its options: drop-downs, list boxes, radio buttons, button groups and the AI value prediction.
- If the rule has sorting rules, they replace the sorting of its query (tab "Query"). Without sorting rules, the sorting of the query applies; without that, the database decides, and the order can differ from call to call.
- The database sorts before the number of options is limited. With a long list, the first options shown really are the first ones in this order.
- If several list or lookup rules apply to the same field, their options are listed rule after rule. To sort across all rules, or by an order that no field holds, use the sorting setting of the input block instead (see Forms).
Recommendation: whenever the order matters, add at least one sorting rule – usually the lookup field in ascending order.
4. Example¶
Priorities in business order. The lookup entity Priority has the fields Name and Rank
(1 = Critical, 2 = High, 3 = Medium, 4 = Low). Sorting rule: "Field" = Rank,
"Direction" = Ascending. The drop-down shows Critical, High, Medium, Low – not the
alphabetical order Critical, High, Low, Medium.