Skip to content

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 ​

ParameterTypeDescription
mappingNamestringThe name of the mapping.
leftDimensionsstring[]The dimensions on the left side.
rightDimensionsstring[]The dimensions on the right side.
leftManybooleanOptional. true to let a left element map to many right elements. Defaults to false.
rightManybooleanOptional. true to let a right element map to many left elements. Defaults to false.

Returns ​

boolean

true 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);