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

# Apply operator

> Apply an operation to fields 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>;
};

Calculates a value from two fields in your data and writes the result back into it. You pick an operation, such as adding numbers together or joining text, point it at two values, and choose where to store the outcome. Use this for things like adding shipping to a price, combining quantities, or building one text value from two others.

This documentation describes: [Schema](/schemas/transformer/operator)

## Fields

<FormField property="operator" label="Operator" required diType="operator">
  The operation to perform on the two values, for example Math: Add, Math: Multiply, or String: Concatenate. See [Operators](/references/operator) for the full list of operations you can choose.
</FormField>

<FormField property="left" label="Left" required>
  The path to the first value used in the operation, for example `price`. The value is read from this path in the current data.
</FormField>

<FormField property="right" label="Right" required>
  The path to the second value used in the operation, for example `shipping`. The value is read from this path in the current data.
</FormField>

<FormField property="destination" label="Destination">
  The path where the result is written, for example `total`. If you leave this empty, the result is written back to the Left path, overwriting that first value.
</FormField>

## Sample data

In this example the Math: Add operation adds the price and the shipping cost together and stores the result in a new `total` field. The two source fields are left untouched.

| Field       | Value                  |
| ----------- | ---------------------- |
| Operator    | Math: Add (`addition`) |
| Left        | `price`                |
| Right       | `shipping`             |
| Destination | `total`                |

Input:

```json theme={null}
{
    "price": 80,
    "shipping": 5.5
}
```

Output:

```json theme={null}
{
    "price": 80,
    "shipping": 5.5,
    "total": 85.5
}
```

```json Configuration theme={null}
{
  "prototype": "operator",
  "parameters": {
    "operator": "addition",
    "left": "price",
    "right": "shipping",
    "destination": "total"
  }
}
```
