Skip to content

Delete Database Records

Original guide · All levels · Server Connect

You can delete database records using the built in Delete Database step in server connect. We will add a delete button to an existing repeat region, which shows the records on our page - so when click

First, create a new server action in server connect panel:

Section titled “First, create a new server action in server connect panel:”

You can delete database records using the built in Delete Database step in server connect. We will add a delete button to an existing repeat region, which shows the records on our page - so when clicked it will delete the record and refresh the data.

First, create a new server action in server connect panel:

Select the server action we just created and right click $_POST under Globals:

Section titled “Select the server action we just created and right click $_POST under Globals:”

We will use this variable to pass the selected record ID to the delete step. Let’s call it “deleteid”:

Section titled “We will use this variable to pass the selected record ID to the delete step. Let’s call it “deleteid”:”

Select the same connection which you are using for your repeat region on the page:

Section titled “Select the same connection which you are using for your repeat region on the page:”

Then, right click the database connection step:

Section titled “Then, right click the database connection step:”

Select the table, you want to delete records from. Usually it is the same as the one, which you are using for the repeat region on your page:

Select the ID column of your database table:

Section titled “Select the ID column of your database table:”

And click the dynamic data picker for its value:

Section titled “And click the dynamic data picker for its value:”

Select the “deleteid” POST Variable(1) which we created and click the select button(2):

Section titled “Select the “deleteid” POST Variable(1) which we created and click the select button(2):”

We select the table in app structure(1) and click the run button(2):

Section titled “We select the table in app structure(1) and click the run button(2):”

On our page we are using a dynamic table, so we will add another column to it where we will place the delete button. If you are not using dynamic table but just a regular repeat region you can skip the following steps related to adding a new column.

We select the table in app structure(1) and click the run button(2):

Add a name to it, it will be displayed in the table header:

Section titled “Add a name to it, it will be displayed in the table header:”

Set the form method to POST in the properties panel:

Section titled “Set the form method to POST in the properties panel:”

Then set the form handler to Server Connect:

Section titled “Then set the form handler to Server Connect:”

And select the Delete Server Action, which we created:

Section titled “And select the Delete Server Action, which we created:”

Now, as our form is ready we need to add a hidden field inside it, which will pass the ID to the server action. Its name/id should be the same as the POST variable which we created in the Delete Server Action - “deleteid”.

Right click the form:

Set its name and ID to “deleteid” (the same as the name of POST variable in the delete server action):

Section titled “Set its name and ID to “deleteid” (the same as the name of POST variable in the delete server action):”

With the hidden field selected, add new dynamic attribute:

Section titled “With the hidden field selected, add new dynamic attribute:”

Click the dynamic data picker for the value:

Section titled “Click the dynamic data picker for the value:”

Our hidden field is properly setup, now let’s add a submit button inside the form. Right click the form:

Section titled “Our hidden field is properly setup, now let’s add a submit button inside the form. Right click the form:”

Double click the button in design view and enter the text you need there:

Section titled “Double click the button in design view and enter the text you need there:”

We enter “Delete” as it is a delete button:

Section titled “We enter “Delete” as it is a delete button:”

You want your users to see when a record is deleted, so you need to reload the data source which shows the data on the page. Right click the form(1) and add new dynamic event(2):

Pick and action to be executed, when a record has been successfully deleted:

Section titled “Pick and action to be executed, when a record has been successfully deleted:”

Under the server action, which repeats the data on the page select Load(1) and click the add button(2).
Make sure not to select the delete record server action!

And you are done. As soon as you click the Delete button, the record will be deleted and the data on the page will be reloaded.