
# Advanced Fields

Nine specialized field types cover computed values, generated identifiers, interactive controls, and structured data. This page also documents `barcode` (a media-category field). All share the [base field properties](/en/docs/tables-overview#base-field-properties).

| Type          | Stores / does                                             |
| ------------- | --------------------------------------------------------- |
| `formula`     | A value computed from a formula expression.               |
| `count`       | A count of related records.                               |
| `autonumber`  | An auto-incrementing number with prefix and zero-padding. |
| `button`      | An interactive button triggering a URL or automation.     |
| `json`        | Structured JSON data.                                     |
| `array`       | An array of typed values.                                 |
| `color`       | A hex color value.                                        |
| `code`        | Source code with syntax highlighting.                     |
| `geolocation` | Latitude/longitude coordinates.                           |
| `barcode`     | A barcode value (media category — see below).             |

## `formula`

Computes a value from a formula expression referencing other fields.

| Property     | Description                                                                               |
| ------------ | ----------------------------------------------------------------------------------------- |
| `formula`    | **Required.** Expression to compute. Supports field references, operators, and functions. |
| `resultType` | Expected data type of the result (e.g. `string`, `number`, `boolean`, `date`).            |
| `format`     | Display format for the result (e.g. `currency`, `percentage`, `decimal`, `date`).         |

```yaml
- { id: 1, name: total_price, type: formula, formula: 'price * quantity', resultType: number }
```

## `count`

Counts the number of records linked through a relationship field in the same table. A simplified `rollup`.

| Property            | Description                                                                 |
| ------------------- | --------------------------------------------------------------------------- |
| `relationshipField` | **Required.** Name of the relationship field whose linked records to count. |
| `filters`           | Optional filter expression — count only matching linked records.            |

```yaml
- {
    id: 2,
    name: completed_task_count,
    type: count,
    relationshipField: tasks,
    filters: { field: status, operator: equals, value: completed },
  }
```

## `autonumber`

An auto-incrementing number with an optional prefix and zero-padding.

| Property    | Description                                                      |
| ----------- | ---------------------------------------------------------------- |
| `prefix`    | Optional text prepended to the number (e.g. `INV-`, `ORD-`).     |
| `startFrom` | Starting number (integer ≥ 1).                                   |
| `digits`    | Minimum digit count with zero-padding. Integer from **1 to 10**. |

```yaml
- { id: 3, name: invoice_number, type: autonumber, prefix: 'INV-', startFrom: 1000, digits: 5 }
```

## `button`

An interactive button rendered on records that triggers an action.

| Property     | Description                                                         |
| ------------ | ------------------------------------------------------------------- |
| `label`      | **Required.** Button text.                                          |
| `action`     | **Required.** Type of action to trigger (e.g. `url`, `automation`). |
| `url`        | URL to open (when `action` is `url`).                               |
| `automation` | Automation name to run (when `action` is `automation`).             |

```yaml
- {
    id: 4,
    name: approve,
    type: button,
    label: Approve,
    action: automation,
    automation: approve_request,
  }
```

:::callout
**Corrected from earlier docs.** The button field uses `label`, `action`, `url`, and `automation` — **not** `buttonLabel` / `buttonAction` / `buttonUrl`.
:::

## `json`

Stores structured JSON data with optional schema validation.

| Property | Description                                          |
| -------- | ---------------------------------------------------- |
| `schema` | Optional JSON Schema object for validating contents. |

```yaml
- { id: 5, name: metadata, type: json, required: false }
```

## `array`

Stores an array of values with optional type and length constraints.

| Property   | Description                                  |
| ---------- | -------------------------------------------- |
| `itemType` | Data type of array elements (e.g. `string`). |
| `maxItems` | Maximum number of elements (integer ≥ 1).    |

```yaml
- { id: 6, name: tags, type: array, itemType: string, maxItems: 10 }
```

## `color`

Stores a color value in hexadecimal format. Rendered with a color picker.

| Property  | Description                                            |
| --------- | ------------------------------------------------------ |
| `default` | Default color as a 6-digit hex value (e.g. `#3B82F6`). |

```yaml
- { id: 7, name: brand_color, type: color, required: true, default: '#3B82F6' }
```

## `code`

Stores source code as plain text with syntax highlighting (CodeMirror 6).

| Property      | Description                                                                                                                            |
| ------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| `language`    | **Required.** Language for highlighting (e.g. `javascript`, `typescript`, `yaml`, `json`, `python`, `sql`, `html`, `css`, `markdown`). |
| `lineNumbers` | Boolean. Show line numbers.                                                                                                            |
| `readOnly`    | Boolean. Make the editor read-only.                                                                                                    |
| `minLines`    | Minimum visible lines (integer ≥ 1).                                                                                                   |
| `maxLines`    | Maximum visible lines before scrolling (integer ≥ 1).                                                                                  |
| `tabSize`     | Tab size in spaces. Integer from **1 to 8** (default 2).                                                                               |

```yaml
- { id: 8, name: snippet, type: code, language: typescript, lineNumbers: true, tabSize: 2 }
```

## `geolocation`

Stores geographic coordinates (latitude and longitude) for location-based features. Takes no type-specific properties beyond the base field properties.

```yaml
- { id: 9, name: office_location, type: geolocation, required: true }
```

## `barcode`

Stores a barcode value for product identification and inventory. (Categorized under media, documented here with the other specialized value fields.)

| Property | Description                                |
| -------- | ------------------------------------------ |
| `format` | Barcode format (e.g. `EAN-13`, `CODE128`). |

```yaml
- { id: 10, name: product_barcode, type: barcode, required: true, format: EAN-13 }
```

:::callout
**Computed fields update automatically.** `formula`, `count`, and `rollup` (see [Relational Fields](/en/docs/relational-fields)) are derived — they recompute when their inputs change and are not directly editable.
:::
