Links

Update Row action

The Update Row action allows you to update a row or multiple rows in a table by a given condition.
First, you need to specify the filter condition to find the row to update.
// id = 23
{{ui.table.updatedRow.data.id}}
Then you can specify the values to update, you can do it field by field:
// name = 'John'
{{ui.table.updatedRow.data.name}}
send the updated values as an Object by clicking on the JS button above the right corner of the field:
{{ui.table.updatedRow.data}}
or as plain js Object:
{
name: "John",
age: 30
}
This object will be sent to the server and converted to an UPDATE statement like this:
UPDATE users SET name = 'John', age = 30 WHERE id = 23
Note: you can check the Payload section to see the actual object sent to the server.
Note: the unset fields will be presented as undefined and will not be used in the UPDATE statement.
{
id: 23,
created_at: "2022-10-21",
// this value will not be sent to the server
required_at: undefined,
}
You can always adjust the data before sending it.

Add additional values

const values = {{ui.form.value}};
return {
...values,
updated_at: new Date(),
}
The created_at column must exist in the table schema, otherwise it will not be sent.

Change the values

const values = {{ui.form.value}};
return {
...values,
name: values.name.toUpperCase(),
}

Delete unwanted values

const values = {{ui.form.value}};
delete values.age;
return values;
alternatively:
const values = {{ui.form.value}};
const { updated_at, ...rest } = values;
return rest;

Join array values

const values = {{ui.form.value}};
return {
...values,
tags: values.tags.join(','),
}

Use default values

const values = {{ui.form.value}};
return {
...values,
// if the value is not set, use the default value
created_at: values.created_at || new Date(),
}

Additional settings

If you need to update multiple rows, you can use the Bulk update setting.
Note: be careful with this setting, it can update all rows in the table.