Header / Detail (Order and Order Lines)¶
AgileData.io is very flexible and allows you to name your Concepts, Details and Events in any way that makes sense to you or your organisation.
When dealing with data in a system of record that has a Header table and a Detail table there are a number of patterns we have seen for how you name these. These can also be referred to as Master and Detail data.
Feel free to pick one and use it or define your own pattern.
Examples of Header/Detail source tables we have seen are:
Order / Order Line
Order / Line Item
Invoice / Invoice Line
Product / Product Variant
These examples are interchangeable in the pattern, for our examples we will use Order / Order Line .
Concept and Detail Pattern¶
Multiple Concept definitions (recommended)¶
In this pattern we define multiple Concepts, one for the header and one for the detail.
Order Concept
Order Line Concept
Then we define the relevant Details for each Concept.
Order Detail
Order Line Detail
So for example we would define Detail for the Order Concept that would contain Order Date, Customer and Total Order Value. And we would define Detail for the Order Line Concept that would contain Product, Quantity and Order Line Value.
Good¶
AgileData will automatically create two consume view, one that provides access to all the Order information and a second that provides access tot he Order Line information;
Not so good¶
If you want to see details about the Order concept at the same time as details about the Order Line concept, you will need to define an Event or a Consume view that joins the two;
Multiple Detail definitions¶
In this pattern we define a single header Concept.
Order Concept
Then we define multiple Details for the Concept.
Order Detail
Order Line Detail
So for example we would define Order Detail for the Order Concept that would contain Order Date, Customer and Total Order Value. And we would define Order Line Detail for the Order Concept that would contain Product, Quantity and Order Line Value.
Good¶
AgileData will automatically provide a single consume view that has both Order and Order Line information in it;
Not so good¶
If you want to report on just the Order informaton you will need to either use a distinct query in your reporting tool for the Order data, or define a Consume view that subsets the data to only show Order information;
As you are storing both the Order and the Order line data together, any Order related queries will be slightly slower than the Multiple Concept pattern as more data is being stored together.