# 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/de/reference/steps/update-row

## Auf einen Blick

| Eigenschaft | Wert |
| --- | --- |
| **Schrittname** | `update-row` |
| **Ressource** | ClusterStep (`lumen.ai/v1alpha1`) |
| **Palettengruppe, Kategorie** | save, tables |
| **Credits** | **1** Credit bei jedem Erfolg |
| **Externe Wirkung** | ja: Er ändert etwas außerhalb von Lumen, deshalb fragt ein Wiederholungsversuch vorher nach, und ein Test zeigt, was er tun würde, statt es zu tun. |
| **Die Installation muss bereitstellen** | nichts |

## Eingaben

| Eigenschaft | Wert |
| --- | --- |
| **Braucht** | nichts |
| **Liefert** | `fields` |
| **Arbeitet auf** | item: einem Dokument nach dem anderen |

Braucht und Liefert sind Datentypen (file, text, fields, email). Der Editor bietet einen Schritt nur dort an, wo das, was er braucht, schon auf dem Pfad liegt. Siehe [Dokumente und Daten](https://docs.go-lumen.ai/de/concepts/how-flows-run.md#documents-and-data).

## Ausgaben

Ein späterer Knoten verweist auf eine Ausgabe als `{nodeId.field}` in einem Text oder als `nodeId.field` in einer Bedingung.

| Ausgabe | Typ |
| --- | --- |
| `rowId` | string |
| `updated` | boolean |

## Einstellungen

Wird unter `config:` im Knoten des Flows gesetzt. Texteinstellungen dürfen Platzhalter wie `{nodeId.field}` enthalten.

| Einstellung | Typ | Standardwert | Beschreibung |
| --- | --- | --- | --- |
| `sheet` (erforderlich) | 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` (erforderlich) | list of object |  | Where finds the row: the oldest one that passes every test. (minItems 1; maxItems 8) |
| `where[].column` (erforderlich) | 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` (erforderlich) | string |  |  |
| `set` (erforderlich) | 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) |

Das vollständige JSON Schema dieser Einstellungen: [update-row.schema.json](https://docs.go-lumen.ai/schemas/steps/update-row.schema.json).

## Beispiel

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

## Im Flow verwenden

Ein Knoten, der `update-row` ausführt, steht unter `spec.nodes` eines [Flow](https://docs.go-lumen.ai/de/concepts/how-flows-run.md#the-flow-as-yaml). Geben Sie ihm eine beliebige id und nennen Sie in next die ids der nächsten Knoten.

```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}'
```
