About Tuples by Record
The Tuples by Record option is used to generate more than one tuple for every record of the sources.
This could be necessary for some cases depending on the structure of the datasource.
By default the value is 1, that is for every record of the sources only one tuple is generated in the cube.
Example
Suppose you want to define a measure Inventory, that shows the inventory for every month (or a measure Balance). In some cases this information in the database is not defined in different records, but in different columns.
That is, instead of having the information in this format:
Product |
Month |
Inventory |
---|---|---|
A |
01/99 |
250 |
A |
02/99 |
200 |
A |
03/99 |
230 |
...... |
|
|
A |
12/99 |
120 |
B |
01/99 |
100 |
B |
02/99 |
180 |
B |
03/99 |
150 |
B |
12/99 |
140 |
You have the information in this other format:
Product |
Inv01 |
Inv02 |
Inv03 |
... |
Inv12 |
---|---|---|---|---|---|
A |
250 |
200 |
230 |
... |
120 |
B |
100 |
180 |
150 |
... |
140 |
If this is the case, you will need to generate for every record in the source, 12 records for the cube (one for each month).
The steps you should follow are the following:
- Define 12 Tuples per record in the source. Every time O3 reads a record from this source it will generate 12 records.
- Create the following Virtual Fields
Notice that this example shows a simplified notation. The O3 Designer requires the specification of all 12 fields.
Inventory = Choose(TN, Inv01, Inv02, Inv03, ..., Inv12) Date = Date(1, TN, Year(Today()))
Ther first Virtual Field is based on the function Choose(index, value_1, value_2, ..., value_N). This function returns the "value_i" based on the value for "index" (if index=1 it will return value_1, if index=2 it will return value_2, etc.)
The "TN" identifier is substituted by O3 with the value of the current record in the Tuples By Record count (1 to 12 in our example). This means that every one of the 12 records generated for each of the source records will have a different value for the Inventory Virtual Field. The first record will use the Inv01 value, the second the Inv02 and so on.
Use the Inventory virtual field to define the measure Inventory.