Deleting Data Source Rows

The DeleteData function is used to permanently delete one or more rows from a data source table using a filter.

The function’s syntax is as follows:

DeleteData( DataSource, FilterName, MultipleRowDelete );

DataSource is a string containing the name of the data source from which you want to remove data.

FilterName is a string containing the name of a filter associated with the chosen data source. Only values matching this filter will be removed from the database; all other values will be ignored.

MultipleRowDelete is a string containing either True or False, which determines whether or not all rows matching the filter should be deleted. By default, the value is set to "False", which means only the single oldest entry matching the filter will be deleted.

You can use the function's syntax to write the expression manually but there is also the option of using the Data Source Expression wizard to quickly generate the DeleteData expression.

Before implementing either of these options make sure you have created a writeable data source with at least one Filter, so the expression can remove one or more rows returned by a specific filter.

Use the implementation steps below to automatically generate the DeleteData function.

Implementation:

  1. Open the Expression Editor.
  2. If the expression already has some content, place the keyboard cursor where you want the new statement to appear.
  3. Right-click anywhere in the main Expression panel.
  4. Select Create Data Source Expression.
  5. Use the Data Source drop-down menu to select the data source whose rows you want to remove.
  6. Select the Delete an Entry from Your Data Source radio button.
  7. (Optional) If you want the DeleteData statement to remove all rows matching your filter, tick the Delete Multiple Rows check box. Otherwise, it will only remove the first matching row it finds.
  8. Click Next.
  9. Use the Filter Parameter drop-down menu to specify the filter you want to use to identify rows for deletion.
  10. Click Finish.
  11. Save the expression before closing the expression editor.