Implicit and explicit orders
Table of Content
- Localised order in the items of all ItemSchemes
- Localized order in data message for DE filters, table and chart views
Localised order in the items of all ItemSchemes
Implicit means the order of items (e.g. codes) as returned within the array of codes. There are thus always naturally given in a structure definition.
Explicit order is the order provided through annotations and is optional. Explicit order prevails implicit order.
In the data definition, the story is a bit different because the order of codes in dimension arrays is considered “random” (because of potential streaming on server side). The original implicit order is thus returned as an additional code property. With the NSI web service, this property should always be returned. However, we cannot guarantee the presence of this property for other SDMX endpoints.
Explicit order is provided through annotations and is optional. Explicit order prevails implicit order, and implicit order prevails the “random” array order.
The syntax for the explicit localised “ORDER” annotation for items in Codelists and CategorySchemes is:
"annotations": [{
"type": "ORDER"
"text": {
"en": "5",
"fr": "7"
}
}]
In case an unambiguous explicit order is not provided then the SDMX standard’s implicit order of the codes is applied. This rule applies also if the same order number was explicitly specified twice: the implicit order should then prevail between those codes.
Before ordering (implicit or “random” order of dimension values from SDMX ItemScheme):
- Aaa, Explicit order=5
- Bbb, Explicit order=4
- Ccc, Explicit order=3
- Ddd, Explicit order=3
- Eee, Explicit order=2
- Fff
- Ggg, Explicit order=1
- Hhh
- Iii, Explicit order=1
- Jjj
After ordering:
- Fff, Default explicit order=0
- Hhh, Default explicit order=0
- Jjj, Default explicit order=0
- Ggg, Explicit order=1
- Iii, Explicit order=1
- Eee, Explicit order=2
- Ccc, Explicit order=3
- Ddd, Explicit order=3
- Bbb, Explicit order=4
- Aaa, Explicit order=5
Localized order in data message for DE filters, table and chart views
Explicit order of items in an ItemScheme as described above are applied to the DE visualisation page, once the explicit order of codes is returned in the SDMX-JSON data message, and according to the current locale. This means that items of a dimension with a defined order, will be displayed according to that order in the filter selections, and in the rows and columns of the table view.
In some cases, the order is also applied to the chart views for:
- Chart series dimension in vertical and horizontal symbol charts;
- Stack dimension in stacked bar charts.
In the context of a hierarchical dimension, order is always applied per hierarchy branch level. Children always follow subsequently their parents even if the implicit or explicit order number of the child is smaller than that of the parent or greater than that of the following parent.
The table/chart layout has no influence on the dimension value order. Whatever the calculated order is, it is to be applied exactly as calculated, even if the dimension is layered out vertically and the items may be indented, or if the dimension is layered out horizontally and the items are not indented.
When an item of a dimension has no explicit order, then this item will be displayed first in the filter or the table row/column before all the items with an explicit order.
Current known limitations:
- Items without explicit orders are sometimes returned differently by the back-end structure and data messages. In consequence it may happen that, if a dimension has several items without order, then these items are not listed in the same order in the filter and in the table, because filters and table are building their representation with each of the data or structure message.
- In a hierarchy of a dimension, for children items when their parent are not selected, the table lists the children based on their explicit order and in correspondance with the other selections, meaning that children can be displayed “randomly” if they have no parent selected in the table view.