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

## De un vistazo

| Propiedad | Valor |
| --- | --- |
| **Nombre del paso** | `update-row` |
| **Recurso** | ClusterStep (`lumen.ai/v1alpha1`) |
| **Grupo de la paleta, categoría** | save, tables |
| **Créditos** | **1** crédito cada vez que tiene éxito |
| **Efectos externos** | sí: Cambia algo fuera de Lumen, así que un reintento pregunta antes y una prueba muestra lo que haría en lugar de hacerlo. |
| **La instalación debe aportar** | nada |

## Entradas

| Propiedad | Valor |
| --- | --- |
| **Necesita** | nada |
| **Produce** | `fields` |
| **Trabaja sobre** | item: un documento cada vez |

Necesita y Produce son tipos de datos (file, text, fields, email). El editor ofrece un paso solo donde lo que necesita ya está en el camino. Consulta [Documentos y datos](https://docs.go-lumen.ai/es/concepts/how-flows-run.md#documents-and-data).

## Salidas

Un nodo posterior se refiere a una salida como `{nodeId.field}` en un texto, o `nodeId.field` en una condición.

| Salida | Tipo |
| --- | --- |
| `rowId` | string |
| `updated` | boolean |

## Ajustes

Se definen bajo `config:` en el nodo del flujo. Los ajustes de texto pueden contener marcadores de posición como `{nodeId.field}`.

| Ajuste | Tipo | Valor por defecto | Descripción |
| --- | --- | --- | --- |
| `sheet` (obligatorio) | 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` (obligatorio) | list of object |  | Where finds the row: the oldest one that passes every test. (minItems 1; maxItems 8) |
| `where[].column` (obligatorio) | 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` (obligatorio) | string |  |  |
| `set` (obligatorio) | 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) |

El JSON Schema completo de estos ajustes: [update-row.schema.json](https://docs.go-lumen.ai/schemas/steps/update-row.schema.json).

## Ejemplo

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

## Úsalo en un flujo

Un nodo que ejecuta `update-row` va bajo `spec.nodes` de un [Flow](https://docs.go-lumen.ai/es/concepts/how-flows-run.md#the-flow-as-yaml). Dale cualquier id y enumera en next los ids de los nodos siguientes.

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