> ## 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.

# Move using an accessor

> The Accessor-move Transformer is used to take a part from the entity data and move it somewhere else in the structure.

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>;
};

Takes a part of the entity data and moves it somewhere else in the structure. It works just like [Copy using an accessor](/references/transformer/accessor-copy), except the original data is removed once it has been placed in its new location. Because you choose a way of reading values for the source and a way of writing them for the destination, you can move several matching values at once, such as lifting every line item's SKU out into a separate list. Use this to reshape an entity rather than duplicate data.

This documentation describes: [Schema](/schemas/transformer/accessor-move)

## Fields

<FormField property="source" label="Source" required diType="accessor">
  The way of reading the values you want to move. Every value this reads is moved to the destination and then removed from its original spot. For example, a pattern accessor matching `order.items.*.sku` reads the SKU of every item in an order.
</FormField>

<FormField property="destination" label="Destination" required diType="accessor">
  The way of writing the moved values into the entity. For example, a key accessor with a root of `skus` places the values under a new `skus` location.
</FormField>

<FormField property="stripEnclosures" label="Strip enclosures from keys">
  Controls how a source path that contains dots is treated at the destination. When on (the default), a path such as `order.items.0.sku` is read as a nested path, so the moved value keeps that nested structure under the destination. When off, the whole path is kept as a single literal key. Leave it on unless you specifically want the dotted path preserved as one key.
</FormField>

## Sample data

| Field                      | Value                                         |
| -------------------------- | --------------------------------------------- |
| Source                     | Pattern accessor matching `order.items.*.sku` |
| Destination                | Key accessor with root `skus`                 |
| Strip enclosures from keys | On (default)                                  |

Input:

```json theme={null}
{
    "order": {
        "items": [
            { "sku": "A1", "qty": 2 },
            { "sku": "B2", "qty": 5 }
        ]
    }
}
```

Output:

```json theme={null}
{
    "order": {
        "items": [
            { "qty": 2 },
            { "qty": 5 }
        ]
    },
    "skus": {
        "order": {
            "items": [
                { "sku": "A1" },
                { "sku": "B2" }
            ]
        }
    }
}
```

Every matched SKU has been moved out of the line items and into the new `skus` location, so `order.items` now only carries the quantities.

```json Configuration theme={null}
{
  "prototype": "accessor-move",
  "parameters": {
    "source": { "prototype": "pattern", "parameters": { "pattern": "order.items.*.sku" } },
    "destination": { "prototype": "key", "parameters": { "root": "skus" } }
  }
}
```
