Many tables used in X-Cross don’t simply have a flat structure, but a hierarchical one, where every element of the table can be connected to a parent one in a node-subnode structure, in which every branch can have a different number of levels.
The classic example of tree table is a chart of accounts
where the records are organized in levels and sublevels, but in many other cases a tree structure is preferrable to a flat one, for example:
- Clients categories
- Sale zones
- Stock items categories
and many others.
Tha X-Cross tree tables
The tree tables are used in many parts of the program, and all of them have the same structure.
Every record of the table can be connected or not to a parent record. The top level records are not connected to a parent one.
The tree is created whan the table is read, via a view that creates tha various levels in a very fast way.
The tree table structure
Each level of a tree table can be numeric or alphanumeric, can have a maximum lenght, and the code level can repeat the code of the parent or not.
The default values for this setting can be overrided by the user settings, so the codes structure can be customized.
Modify the tree table structure
The tree table structure can be modified at any time, and the codes of the single records can be modified accordingly if the parent code is repeated.
Since the connection to the child records (transactions) is achieved via the record ID, the record codes can be changed at any time even if the record has been used in transactions.
Searches on tree tables
In searches that use as paramters records of a tree table, all the subtable of a node can be used.
For example, let’s imagine to have a table of client zones with the following structure:
The clients will be connected to the lowest level (e.g. France,Italy or Austria); if we select Europe, the clients of all the three nations will be found.