# לעדכן שורה בטבלה

> מוצא בטבלה את השורה שמתאימה ומשנה את העמודות שבחרתם.

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

## במבט אחד

| מאפיין | ערך |
| --- | --- |
| **שם השלב** | `update-row` |
| **משאב** | ClusterStep (`lumen.ai/v1alpha1`) |
| **קבוצה וקטגוריה** | save, tables |
| **קרדיטים** | **1** קרדיט בכל פעם שהוא מצליח |
| **השפעה חיצונית** | כן: הוא משנה משהו מחוץ ל-Lumen, ולכן ניסיון חוזר שואל קודם, ובדיקה מראה מה הוא היה עושה במקום לעשות את זה. |
| **ההתקנה צריכה לספק** | כלום |

## קלט

| מאפיין | ערך |
| --- | --- |
| **צריך** | כלום |
| **מפיק** | `fields` |
| **עובד על** | item: מסמך אחד בכל פעם |

״צריך״ ו״מפיק״ הם סוגי נתונים (file, text, fields, email). העורך מציע שלב רק במקום שבו מה שהוא צריך כבר נמצא במסלול. ראו [מסמכים ונתונים](https://docs.go-lumen.ai/he/concepts/how-flows-run.md#documents-and-data).

## פלט

צומת מאוחר יותר מפנה לפלט כ-`{nodeId.field}` בטקסט, או כ-`nodeId.field` בתנאי.

| פלט | סוג |
| --- | --- |
| `rowId` | string |
| `updated` | boolean |

## הגדרות

מגדירים תחת `config:` בצומת של התהליך. הגדרות טקסט יכולות להכיל מצייני מקום כמו `{nodeId.field}`.

| הגדרה | סוג | ברירת מחדל | תיאור |
| --- | --- | --- | --- |
| `sheet` (חובה) | 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` (חובה) | list of object |  | Where finds the row: the oldest one that passes every test. (minItems 1; maxItems 8) |
| `where[].column` (חובה) | 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` (חובה) | string |  |  |
| `set` (חובה) | 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) |

ה-JSON Schema המלא של ההגדרות: [update-row.schema.json](https://docs.go-lumen.ai/schemas/steps/update-row.schema.json).

## דוגמה

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

## שימוש בתהליך

צומת שמריץ את `update-row` נכנס תחת `spec.nodes` של [Flow](https://docs.go-lumen.ai/he/concepts/how-flows-run.md#the-flow-as-yaml). תנו לו כל מזהה, ורשמו ב-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}'
```
