In this article
An unbalanced hierarchy is a hierarchy where all levels are defined in the same table. This type of hierarchy is also called "self-referenced". As an example, assume we have a company, called “The Company”, with the following organizational structure - :
Figure 1 - Example of organization hierarchy in "The Company"
This hierarchy will be set up in the table “CompanyTable”.
- In the Database Designer, create and save a new schema.
- Open the schema, go to the Tables tab and click Add, and give the table the name “CompanyTable” - .
- Click the table ID to open the table, then set up the language(s) you want to use.
- If necessary, change the width of the “primary key” field that will hold the unique ids (codes) of the entities in the table.
- Go to the Captions tab and assign name(s) to the table for the various languages you have selected.
- Go to the Relations tab and add a relation to the same table (a self-referencing relation), and save - :
- Select the table in the table list by clicking in the left column next to it, and click the Generate button to set up the table - .
- Then go back to the table (click on the Table ID) to define the table content (note that the Contents tab is not available until the table has been generated).
- In the Contents tab, set up the hierarchy of “The company” with the following table - :
- To define this set up as a hierarchy, select the Hierarchies tab in the schema designer, click Add Hierarchy to add a hierarchy, give the hierarchy a name and then click Save - :
- Click the hierarchy ID and go to the “Hierarchy structure” tab to select the self-referencing relation in the “companytable”. Then click Save - :
The result should be as shown below.
Figure 2 - The table list
Figure 3 - Setting up a self-referencing relation
Note: This relation must be set up as not required (do not check off the “Required” checkbox), because the top level does not have an entity above it to which it can refer.
Figure 4 - Generating the table
Figure 5 - A self-referencing table
Note: You can add data to the table directly by typing it in, by copying and pasting from a file, or by importing a file.
Figure 6 - Adding hierarchy
Figure 7 - Selecting relations in the hierarchy
The Hierarchy Tree tab displays the hierarchy as a tree structure, as shown in the example below - .
Figure 8 - Example of the Hierarchy Tree tab
Here you can rearrange the nodes in the hierarchy by dragging and dropping them as required, and select the display language from the drop-down list. You can also edit the node texts - click on a text to open the editing pane for that item.