The Delete Records from Table action allows you to delete one or more records from a specified table.
Note: Deleting records is a permanent move.
To specify which records to delete, you will need to set up a pattern, or a condition, which will match the records you wish to delete. In order to create this condition, you will use the criteria builder.
▶ Select a Table Name: the table you wish to delete from
▶ Delete Records Where: the criteria builder will let you build a condition to match all the records you need to delete
When you select Open criteria builder, a new page opens listing all the conditions. How does this function delete records? It will look at every record in the table and compare each record to the given conditions. If the record matches the condition, then the record gets deleted.
▶ If All/Any of the following are true: This applies when you have one or more conditions or groups of conditions.
All - Every condition must be true in order to delete.
Any - At least ONE of the conditions is true in order to delete.
▶ Field: the first dropdown is the field to check in the table
▶ Comparison: the second dropdown is the comparison operation to perform between the field and the given value
▶ Value: the next two fields specify the value to compare the field to
▶ Add another condition: create additional conditions
▶ Add another group: you can separate conditions into groups. This is similar to how parentheses work in mathematical equations - conditions in groups are calculated together.
For more information, please check our article on The Criteria Builder.
The following are examples showing different criteria and how a record or records would be deleted from the table.
The function will go through all the records in each table, comparing each record's RecordID field to the number 5. If it finds a record with a RecordID of 5, then that record gets deleted. Of course, since RecordIDs are unique, only one record gets deleted.
The function will go through all the records in each table, checking if its RecordID field is greater than zero. Of course, EVERY Record ID is greater than zero, so in effect, this will delete every record in the table!
Note that we have changed it to "If ANY of the following are true." The function will go through all the records in each table, checking if the name is either Bob OR Robert. If a record has either of those names, then the record is deleted.
This time, we have added three groups. Note within each group you can set it to Any or All.
Group 1: Returns true if the record is named either Bob or Robert.
Group 2: Returns true if the age is between 12 and 20 (i.e. 13-19).
Group 3: Returns true if the birth month is May.
A record is deleted only if all three groups are true. If any one of the groups is not true (e.g. Age is 25), then the record is not deleted.