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

# Expand path

> Combines the existing data and value moving all paths from source to destination pattern.

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

Finds every path that matches a source pattern and writes a value at a matching destination path for each one. The original data stays in place; this feature adds the new destination entries alongside it. Use it to build a new structure out of a repeating one, for example creating an entry under a new key for every item in a list. Each `*` in the source becomes a numbered capture, so the destination and value can place each result in its own spot.

This documentation describes: [Schema](/schemas/transformer/expand-path)

## Fields

<FormField property="source" label="Source" required uiPatterns="pattern">
  The pattern that finds the paths to work from. Use `*` to match every item in a list, for example `items.*`. Each `*` becomes a numbered capture (`$1`, `$2`, and so on) that you can reuse in the Destination and Value fields.
</FormField>

<FormField property="destination" label="Destination" required>
  The path where each result is written. Reference the captures from the source with `$1`, `$2`, and so on, so each match lands at its own destination, for example `lines.$1.status`.
</FormField>

<FormField property="value" label="Value" required>
  The value written at each destination. This can be a fixed text such as `pending`, or it can reference the source captures with `$1`, `$2`, and so on to write the matched index back into the data.
</FormField>

## Sample data

| Field       | Value             |
| ----------- | ----------------- |
| Source      | `items.*`         |
| Destination | `lines.$1.status` |
| Value       | `pending`         |

For each item, `$1` holds the item's position, so the feature writes a `status` of `pending` under a matching entry in `lines`.

Input:

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

Output:

```json theme={null}
{
    "items": [
        { "sku": "A1" },
        { "sku": "B2" }
    ],
    "lines": [
        { "status": "pending" },
        { "status": "pending" }
    ]
}
```

```json Configuration theme={null}
{
  "prototype": "expand-path",
  "parameters": {
    "source": "items.*",
    "destination": "lines.$1.status",
    "value": "pending"
  }
}
```
