Add a row to a table
Paso
add-rowsaveefectos externosAdds the details found as a row in one of your tables, or updates the row with the same key.
De un vistazo
| Propiedad | Valor |
|---|---|
| Nombre del paso | add-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 | fields |
| 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.
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 |
rowCreated | 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 |
|---|---|---|---|
sheetobligatorio | 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 |
El JSON Schema completo de estos ajustes: add-row.schema.json.
Ejemplo
config
mapping:
city: '{city}'
contact: '{contact}'
name: '{name}'
status: '{status}'
mode: insert
sheet: Suppliers
Úsalo en un flujo
Un nodo que ejecuta add-row va bajo spec.nodes de un Flow. Dale cualquier id y enumera en next los ids de los nodos siguientes.
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
¿Te ha resultado útil esta página?