Unlike a fact table that we want to make a pivotable from, we could use, in this project, a simple Cartesian format. Example, we have a unique set of natural keys, and a set of values.
Let's take this for example:
Date | Employee | Score | WorkshiftDuration
Day 1 | Vincent | 10% | 9h
Day 1 | Steph | 99% | 8h
Day 2 | Vincent | 60% | 5h
Day 2 | Steph | 55% | 6h
In this last "table", we can see that the natural key is composed of two fields (Date and Employee). The data is composed of two values: Score and WorkshiftDuration, which are both expressed numerically.
This, however, doesn't seem like it can be read from the pivotableform.
The key with this dataformat is that we have some fields for the natural key, and some fields for the values. We do not even need to aggregate over the keys, as they should be unique.
To make it possible, I believe that the script should do the following things upon receiving the data:
- Knowing that the data format is tabular, and not a fact table.
- Determine which are the columns in the key, and what columns are values
- Run some tests to avoid duplicate values in the keys
- Keep the aggregators. We cannot assume that the new aggregator is always going to be "first". What if the user removes a field of the key from its table?