# Update a row in a table

> Finds the row in one of your tables that matches and changes the columns you choose.

Source: https://docs.go-lumen.ai/reference/steps/update-row

## At a glance

| Property | Value |
| --- | --- |
| **Step name** | `update-row` |
| **Resource** | ClusterStep (`lumen.ai/v1alpha1`) |
| **Palette group, category** | save, tables |
| **Credits** | **1** credit each time it succeeds |
| **Side effects** | yes: It changes something outside Lumen, so a retry asks first and a test shows what it would do instead of doing it. |
| **Installation must provide** | nothing |

## Inputs

| Property | Value |
| --- | --- |
| **Needs** | nothing |
| **Produces** | `fields` |
| **Works on** | item: one document at a time |

Needs and Produces are data types (file, text, fields, email). The editor offers a step only where what it needs is already on the path. See [Documents and data](https://docs.go-lumen.ai/concepts/how-flows-run.md#documents-and-data).

## Outputs

A later node references an output as `{nodeId.field}` in text, or `nodeId.field` in a condition.

| Output | Type |
| --- | --- |
| `rowId` | string |
| `updated` | boolean |

## Settings

Set under `config:` on the flow node. Text settings may contain `{nodeId.field}` placeholders.

| Setting | Type | Default | Description |
| --- | --- | --- | --- |
| `sheet` (required) | string |  | Name of the table whose row to update. (minLength 1) |
| `base` | string |  | Name of the base (database) the table is in. Optional: when set, the table must belong to this base. (minLength 1) |
| `where` (required) | list of object |  | Where finds the row: the oldest one that passes every test. (minItems 1; maxItems 8) |
| `where[].column` (required) | string |  | (minLength 1) |
| `where[].op` | string | `"eq"` | Op is eq (the default), contains (text, case-insensitive), or gt, gte, lt, lte (numbers, amounts and dates). (one of eq, contains, gt, gte, lt, lte) |
| `where[].value` (required) | string |  |  |
| `set` (required) | map of string |  | Set is what to change, as add-row's mapping: a column name to "`{field}`", text with `{placeholders}`, or a plain value. A value that turns out empty leaves its column as it is. |
| `ifMissing` | string | `"fail"` | IfMissing is fail (the default) or skip, when no row passes. (one of fail, skip) |

The full JSON Schema of these settings: [update-row.schema.json](https://docs.go-lumen.ai/schemas/steps/update-row.schema.json).

## Example

Put a supplier on hold

```yaml title="config"
set:
  status: on-hold
sheet: Suppliers
where:
- column: name
  op: eq
  value: '{supplier}'
```

## Use it in a flow

A node that runs `update-row` goes under `spec.nodes` of a [Flow](https://docs.go-lumen.ai/concepts/how-flows-run.md#the-flow-as-yaml). Give it any id, and list the next node ids in next.

```yaml title="flow.yaml"
apiVersion: lumen.ai/v1alpha1
kind: Flow
metadata:
  name: update-row-example
  namespace: tenant-acme
spec:
  displayName: "Update a row in a table"
  triggers:
    - id: start
      ref: {name: manual-run}
      next: [update-row]
  nodes:
    - id: update-row
      stepRef: {name: update-row}
      config:
        set:
          status: on-hold
        sheet: Suppliers
        where:
        - column: name
          op: eq
          value: '{supplier}'
```
