Editing data from a column with a key

In this tutorial you will learn how to change data from a key column in a table or list using save to database and delete from database action steps.

1. List

Create a new list called CUSTOMERS. Add three columns in it: name, mail and employees_no. The key should be marked in the name column. Enter a few lines in the list and save.


2. Editing data from a column with a key


Create a new app and add a table with three columns to it. Name the table Data and give the columns the following headers: 'Customer Name', 'Mail' and 'Number of Employees'. Bind the table with the CUSTOMERS list and bind the columns as shown below. Make all columns editable and enable 'allow add rows' option on section.



Add a Workflow action button and go to the Workflow tab. Add a Save action going out and entering the Start state. Add an action step Save to database on action. Enter the Data table as a section, and the CUSTOMERS list as a list / table. Add an action Refresh page in post workflow.



Set yourself as a draft creator, save and run the app.


Add new data in the empty field and press the save button. A new line should appear in the list with the data you entered.


Change the number of employees in one of the rows and save. The corrected value will appear in the list.


Now change the customer name in one of the lines.



This time row was not corrected, but a new row with the corrected data appeared (row with 'Jan Kowalski' has remained unchanged, but 'Wiktor Kowalski' has been added to the list). This is because during save, data from the section is matched with the rows from Customers list based on value of the key column. In this case, there was no row with a key 'Wiktor Kowalski', so this data was added to the list as a new row.

3. How to change data in a column with a key


Go back to app designer and copy the Data section. Name the new section Delete and change its visibility to false. Also disable the ability to edit and add rows.



Go to the Workflow tab and add a Delete from database action step on the Save action. Enter Delete table as the section and Customers list as the list. The Delete from database step must be above the Save to database step.



Save and run the app. Change one of the customer's names and save it.


Now the changed data shows up on the line we were correcting and no new row is added.

It works like this because at the beginning data from the Customers list is put in the Data and Delete tables. User is editing only Data section, in Delete section still remain unchanged rows. Then on workflow action all the rows from Delete section are removed from the Customers list (so the list becomes empty), and finally the corrected data from the Data section is saved to the list as new rows.

Have more questions? Submit a request


Please sign in to leave a comment.
Powered by Zendesk