Statements > Data Access > Delete Records

Delete Records

Tags:  

Description

The delete records Deluge task is used in Form action and Field action scripts to delete existing records from a form, based on the specified criteria.

Syntax

  on  add
{
on success
{
delete from FormName[ Criteria ];
}
}

where,

<formname> - name of the form to delete records
<criteria> - The criteria expression/value based on which the records will be deleted.

Using Script Builder

To add the delete record task in Script Builder,

  1. Select the Form/Field action.
  2. Drag-n-drop the delete records task from the left-side task tree.
  3. Click on Edit to specify the form name and criteria based on which the records must be deleted.
      • All the forms in the current application will be listed in the Select Form list-box.
      • You can specify your own value as criteria in the <criteria> text area or use the expression builder to add a criteria expression.
  4. Click Done to update the values to the task.


Example

The sample code given below deletes all records in the Sample Form whose Email is same as the Email id added to the Contact form. The script is added to the on add -> on success block of the Contact form and will be executed when a new record is added to the Contact form.

form  Contact
{

Name
(
type = text
)

EmailId
(
displayname = "Email 1"
type = email
)

actions
{
on add
{

Submit
(
type = submit
on success
{
delete from Sample[ Email_1 == input.EmailId ];
}

)
Reset
(
type = reset
displayname = "Reset"
)
}

}
}


Related Link

Refer Tips & Tricks -> Deleting Child Records


0 Comments  Show recent to old
Post a comment


 RSS of this page