Data Table Relationships
To relate Data Table Elements to other Elements in MooD you will need to create a Data Table Relationship. Data Table Relationships can be added to Data Tables in the same way normal relationships are added to normal types.
Data Table Relationships relate to a field in a Type that has a primary key. All values in a 'keyed' field are unique, so the Data Table knows which row it is relating to. In a Data Table Type the unique 'keyed' values become the ‘names’ of the Data Elements, whereas in a normal Element Type the 'keyed' field becomes the target for the Data Table Relationship.
In the example the left table is a Data Table, whilst the right is a depiction of a type in MooD.
The values in a Data Table Relationship column can be matched to a field in an Element Type, only if the field has a key. MooD can then relate the corresponding Elements.
All Data Table relationships are one-to-one relationships, so each relationship value must match directly to exactly one Element in MooD. This means all values in the key field in MooD must be unique.
If you want to link a Data Table Element to many Elements, you will need to introduce an intermediate table.
In the example, a relationship is attempting to link one data table Element to two standard MooD Elements – this is not possible with data relationships. In a standard MooD relationship, this can be done by using a multiple relationship instance. A multiple relationship instance can be created after setting the “User can choose” option to “many elements”. See Defining Your Business Landscape for more details.
Introducing an intermediate table (the table in the middle of the example below) allows you to link a data table relationship to a standard relationship to mimic a multiple relationship instance.
How to Create a Data Table Relationship
- Open the Connections tab in Manage Themes
- Expand "Data Table Relationships"
- Click "<New Data Table Relationship Type>" and name the relationship
- The relationship name must be the name of a column in your Data Table.
- In the details section on the right, open the "Can relate to" tab
- Tick the Types the Data Table Relationship can relate to
- Open the Themes tab
- Expand Data Tables, and select the Data Table you want to add the relationship to
- In the details section on the right, open the Definition tab
- Click "Relationship" in the Add section at the bottom
- Only Data Table Relationships will be shown
- Select a Relationship
- Open the type you set the Data Table Relationship to relate to
- Select a whole number field or string field that corresponds to the Data Elements
- Make the field a key
- MooD 15: Tick "This represents a key field to support Data Tables" below the fields
- MooD Architect: Click "Make Key" on the right of the dialogue box
Creating a data table relationship is demonstrated in the short video clip below: