mapping.create
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.
Creates a mapping table with the given name.
js
mapping.create(mappingName, leftDimensions, rightDimensions, leftMany, rightMany);
Parameters
mappingName
- An identifier used to find the target mapping.leftDimensions
-An Array of strings which are the dimension names to include in the leftside of the mapping.rightDimensions
-An Array of strings which are the dimension names to include in the right side of the mapping.leftMany
- (Optional) Atrue
orfalse
which determines whether the elements in the left dimensions may map to many right elements.rightMany
-(Optional) Atrue
orfalse
which determines whether the elements in the right dimensions may map to many left elements.
Example
js
let res = mapping.create("Time to Year and Month", ["Time"], ["Year", "Month"]);
Time to Year and Month
. If the mapping already exists or a dimension does not exist the function will return false
.
js
let res = mapping.create("Date to Month", ["Date"], ["Month"], false, true);
Date to Month
. If the mapping already exists or a dimension does not exist the function will return false
.