1.12 Delete Action Configuration

What is a Delete Action?

The  Delete action deletes records for a selected table. 

Note: Delete actions will only delete records in tables with the Period of Transactional


 How to check a table's period

The table periods are:

Transactional

This allows multiple users to run independent analysis tasks at the same time.

Daily

This is a non-transactional table type, and generates or collects data every day.

Monthly

This is a non-transactional table type, and generates or collects data every month.

Variable

This is a non-transactional table type, and generates or collects data since the more recent run of the table to the current date.

To check the period of a table:

  1. Find the table in the  Repository
  2. Right-click it, then choose  Edit
  3. On the table's  Properties tab, in the Analysis Options section, the Period drop down can be found

Creating Delete Actions

  1. Click the  Delete icon in the toolbar to display any existing tables in the application
    1. Existing tables can be dragged from the Repository onto the canvas, then choose  Delete to create a Delete node
  2. Alternatively, drag the  Delete icon from the toolbar onto the canvas
  3. In the Create Delete Action window:
    1. Enter a name
    2. Choose the Table from the drop down where the records will be deleted
    3. Select Create Action


Creating Delete Actions for File Tables

These settings are in addition to the steps above.

 Click here to expand...

Where the selected table is a  File Table, the delete action can handle the associated file differently to the records, if required, e.g. delete the records but not the file. Note: The deletion/moving of the file occurs before the records are deleted.

FieldDescription
When Records are Deleted...

Choose from:

  • Leave the associated file in the uploaded directory: leave the file on the server
  • Delete the associated file: delete the file from the server
  • Archive the associated file to specified directoryarchive the file to a directory - see below
Archive Directory

Shows when Archive the associated file to specified directory is selected. 

Specify the directory where the archived file should be moved to.

Create Actionflow using Form Actions Wizard

After displaying attributes as fields on a screen, a Form Actions wizard is available to automatically create the Save and Delete Actionflows.

Drag and drop Save Record onto a Save button and Delete Record onto a Delete button, or drag anywhere on the screen to create the button(s) automatically.

Confirmation Messages

When creating delete actions it can be useful to set up confirmation messages that allow users to confirm or cancel the deletion. See 1.13 Confirmation Message Configuration and 3.03 Custom Confirmation Message Configuration.


Worked Examples

Here's a worked example using the School Data (available from the Learning Centre).

In this example, we are using:

  • Course Management screen containing a grid of the School Courses data - this screen was created using the Tile with Buttons template
  • Course Form screen containing form fields and associated with School Courses data by a background filter - this screen was created using the Edit Form template

If you are completing this chapter as part of the Actionflow course and using a training instance, this data has already been pre-loaded into the Actionflow Foundation ApplicationFor this example, we'll be working on configuring buttons on the Course Management screen and Course Form screen.

We want to be able to delete courses on a Course Management screen, using the delete button on the Course Management screen and on the Course Form screen. To do this, we will creating two Delete Actionflows. Both will delete the selected record.

Example 1: Delete Action for Grid

Create a Delete Action to delete courses in the School Courses grid on the Course Management screen.

  1. On the Course Management screen, right-click on the  button and choose  Add Actionflow
  2. Enter a name for the Actionflow,
    1. Name: Delete Course (Course Grid)
    2. Select Confirm
  3. Select Click to Connect under Connections and for the input, choose the School Courses  Grid View Component, then select Connect Input
  4. In the Mappings window that opens, notice that by default the data being used is the selected record
    1. Drag the CourseID attribute from the left (School Courses Grid) into the Drag and Drop area on the right (Input Connection Point)
    2.  
    3. Select Save
  5. Click and drag the  Delete icon from the toolbar onto the canvas
  6. In the Create Delete Action window enter:
    1. Name: DeleteCourse
    2. Table: choose School Courses
    3. Select Create Action
  7. Click and drag the  icon onto the  Delete action node on the canvas
  8. Right-click on the in connector and choose  Open Mappings
    1. Select Map by Name to map the CourseID attribute on the left onto the CourseID attribute on the right
    2. Select Save

       Checkpoint

  9. Close the Actionflow to return to the Course Management screen
  10.  Lock the screen and select a record in the grid, then press the  button

Example 2: Delete Action for Form

Create a Delete Action to delete courses in the School Courses grid on the Course Form screen.

  1. On the Course Management screen, select the  or  button to open the Course Form
  2.  Unlock the screen 
  3. Right-click on the  button on the Course Form and choose  Add Actionflow
  4. Enter a name for the Actionflow,
    1. Name: Delete Course (Course Form)
    2. Click Confirm
  5. Repeat the above steps to configure the Actionflow but make the following changes:
    1. the input is the Course  Form
    2. in the Settings, toggle on  Close screen after action completes - this will close the Course Form when  is pressed

       Checkpoint

  6. Once you have configured the Actionflow, return to the Course Management screen
  7.  Lock the screen, select a record in the grid and press the   button
  8. On the Course Form, press the  button
    1. We can see that the Actionflow is working correctly because the Course Form closes and the selected record is deleted from the School Courses grid


Why do we not reuse the Delete Course Actionflow?

An Actionflow can be reused where the same Actionflow setup is required but with a different input data. The setup of the two Actionflows we created above have one key difference - the Delete Course (Course Form) Actionflow has Close screen after action completes enabled.

If we were to reuse this Actionflow with two different inputs (grid and form), the Close screen after action completes option would need to be consistent across both instances of the Actionflow.