> ## Documentation Index
> Fetch the complete documentation index at: https://docs.alumio.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Map values

> Transforms values in the data.

export const FormField = ({property, label, required = false, diType, uiPatterns, children}) => {
  const patterns = Array.isArray(uiPatterns) ? uiPatterns : uiPatterns ? [uiPatterns] : [];
  return <div style={{
    margin: '1.5rem 0'
  }}>
      <div style={{
    display: 'flex',
    alignItems: 'baseline',
    flexWrap: 'wrap',
    gap: '0.5rem',
    marginBottom: '0.25rem'
  }}>
        <strong>{label}</strong>
        <span style={{
    fontSize: '0.7rem',
    fontWeight: 600,
    textTransform: 'uppercase',
    letterSpacing: '0.04em',
    color: required ? '#6241f5' : '#6b7280'
  }}>
          {required ? 'Required' : 'Optional'}
        </span>
      </div>

      <div>{children}</div>

      {diType || patterns.length > 0 ? <p style={{
    fontSize: '0.85rem',
    color: '#6b7280',
    marginBottom: 0
  }}>
          {diType ? <>
              See the <a href={`/references/${diType}`}>{diType}</a> reference.{' '}
            </> : null}
          {patterns.length > 0 ? <>
              Accepts a <a href={`/documentation/placeholders-and-patterns/patterns#${patterns[0]}`}>pattern</a>.
            </> : null}
        </p> : null}
    </div>;
};

Transforms the values in your data while leaving their keys in place. You point at the values you want to change with an accessor, then choose one or more conversions to apply to each of them. Use this to clean up or reshape values without moving them, for example translating a status code into a readable label, trimming whitespace, or changing text to uppercase. Each matched value is run through the conversions in turn, and the result is written back where it came from; values the conversions leave unchanged are kept as they were.

This documentation describes: [Schema](/schemas/transformer/value-mapper)

## Fields

<FormField property="accessor" label="Accessor" required diType="accessor">
  Selects which values to transform. You pick a way of pointing at data, for example a single key or every item in a list, and each value it matches is run through the conversions below. See [Accessors](/references/accessor) for the available options.
</FormField>

<FormField property="mappers" label="Mappers" diType="mapper">
  The list of conversions applied to each matched value, such as mapping a code to a label, trimming whitespace, or changing text to uppercase. Add several and they run in the order you list them, each working on the result of the one before. Leave it empty to make no change.
</FormField>

## Sample data

| Field    | Value                                                                              |
| -------- | ---------------------------------------------------------------------------------- |
| Accessor | Pattern accessor matching `status`                                                 |
| Mappers  | Map value using dictionary: `paid` to `Paid in full`, `open` to `Awaiting payment` |

Input:

```json theme={null}
{
    "sku": "A1",
    "status": "paid",
    "total": 49.95
}
```

Output:

```json theme={null}
{
    "sku": "A1",
    "status": "Paid in full",
    "total": 49.95
}
```

```json Configuration theme={null}
{
  "prototype": "value-mapper",
  "parameters": {
    "accessor": {
      "prototype": "pattern",
      "parameters": { "pattern": "status" }
    },
    "mappers": [
      {
        "prototype": "dictionary-map",
        "parameters": {
          "map": [
            ["paid", "Paid in full"],
            ["open", "Awaiting payment"]
          ]
        }
      }
    ]
  }
}
```
