# להוסיף שורה לטבלה

> מוסיף את הפרטים שנמצאו כשורה באחת הטבלאות שלכם, או מעדכן את השורה עם אותו מפתח.

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

## במבט אחד

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

## קלט

| מאפיין | ערך |
| --- | --- |
| **צריך** | `fields` |
| **מפיק** | `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 |
| `rowCreated` | boolean |

## הגדרות

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

| הגדרה | סוג | ברירת מחדל | תיאור |
| --- | --- | --- | --- |
| `sheet` (חובה) | string |  | Name of the table to add the row to. (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) |
| `mapping` | map of string |  | Mapping says what goes in each column: a column name to "`{field}`" (that field's value), or to text with `{placeholders}` in it, or to a plain value. A column left out takes the field of the same name. |
| `mode` | string | `"insert"` | Mode is insert (the default: always a new row) or upsert (set the values on the row with the same key, or add one; the Sheet needs a key). (one of insert, upsert) |

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

## דוגמה

```yaml title="config"
mapping:
  city: '{city}'
  contact: '{contact}'
  name: '{name}'
  status: '{status}'
mode: insert
sheet: Suppliers
```

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

צומת שמריץ את `add-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: Connector
metadata:
  name: my-webhook
  namespace: tenant-acme
spec:
  classRef: {name: webhook}
  config: {}
---
apiVersion: lumen.ai/v1alpha1
kind: Flow
metadata:
  name: add-row-example
  namespace: tenant-acme
spec:
  displayName: "Add a row to a table"
  triggers:
    - id: start
      ref: {name: webhook-received}
      connectorRef: {name: my-webhook}
      next: [add-row]
  nodes:
    - id: add-row
      stepRef: {name: add-row}
      config:
        mapping:
          city: '{city}'
          contact: '{contact}'
          name: '{name}'
          status: '{status}'
        mode: insert
        sheet: Suppliers
```
