What We Learn
We learn how to split hierarchical data in different ways.
Scenario
From a new source, OrgMaster Pro, we get an organization structure presented to us as a flat structure, as opposed to a self-referencing structure we loaded in Tutorial 05 of the Intro course. We load this data set into three different target structures. Using aliases, we will load the sama data to:
- a flat structure (as is)
- a hierarchy of classes, where each level in the data goes to its own class
- a self-referencing class
Our data looks like this:
The hierarchy in general behaves like this:
- the lowest level, ORG_ID/ORG_HIER is unique
- the highest level, LEVEL1_ID/LEVEL1_NAME should be unique, but does not have to be
- all other levels may contain duplicates
Modeling
The three target structures look like this:
With the following details:
do this… | …and this will happen |
---|---|
In all classes, set Code to Business key |
This will work. |
Mapping
The basic rule for mapping to these structures are like follows:
- Mapping to a 1:1 flat structure is trivial, no alias
- This also declares the entire source table
- In the two other cases
- Mapping requires an alias for each target class
- The mappings of the different levels are symmetrical, with the exception of level 1 data that does not need to map to Parent unit
- distinct = true is needed to skip duplicates in all but the lowest level
So the mappings will look like this:
Note the symmetry within and between the fixed level and recursive structures.
Refresh and Inspect
Refresh D♯ Engine with the current model export and mappings. Use the D♯ Engine UI to compare the target structures to understand their differences (now ignoring administrative tables):
- The flat structure has a single hub & satellite
- The fixed level structure has as many hub/satellite pairs as there are levels, as well as a link table to point to the upper level
- The recursive structure has one hub, a link and as many satellites as there are levels
Deploy the Changes And Try It Out
Deploy the new classes and run the test script.
Script | Source data | Main points of interest |
---|---|---|
Step 1: Load organization data | A flat organisation hierarchy | Possibility to map the same source to different structures by using aliases. |