mapping.create
Creates a mapping table between the elements of one or more dimensions on the left and one or more on the right.
TIP
One to one mappings are bidirectional, meaning when used in a cube formula it is possible to map from left-to-right and right-to-left.
One to many mappings will only work in one direction when used in cube formula.
js
mapping.create(mappingName, leftDimensions, rightDimensions, leftMany, rightMany)Parameters
| Parameter | Type | Description |
|---|---|---|
mappingName | string | The name of the mapping. |
leftDimensions | string[] | The dimensions on the left side. |
rightDimensions | string[] | The dimensions on the right side. |
leftMany | boolean | Optional. true to let a left element map to many right elements. Defaults to false. |
rightMany | boolean | Optional. true to let a right element map to many left elements. Defaults to false. |
Returns
booleantrue if the mapping was created. false if it already exists or a dimension doesn't exist.
Examples
js
const res = mapping.create("Time to Year and Month", ["Time"], ["Year", "Month"]);js
const res = mapping.create("Date to Month", ["Date"], ["Month"], false, true);