---
url: /process-functions/mapping-create.md
description: Creates a mapping table.
---

# 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

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

## Related

* [mapping.rowAdd](/process-functions/mapping-rowadd)
* [mapping.exists](/process-functions/mapping-exists)
* [mapping.delete](/process-functions/mapping-delete)
