Bulk Delete Action Configuration

What is a Bulk Delete Action?

The  Bulk Delete action deletes records in bulk from a table, such as deleting all records, or those records which satisfy the specified filter criteria set on the node. 

Note: Bulk 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

 Delete vs  Bulk Delete 

The key difference between  Delete and  Bulk Delete is that the Bulk Delete action purges records from PhixFlow, including the audit history of records where Audit Manual Changes has been enabled.

To delete records and persist the audit history of the record, see Delete Node.  

Creating Bulk Delete Actions

  1. Click the  Bulk Delete icon in the Actionflow toolbar to display any existing tables in the application 
    1. Existing tables can be dragged from the Repository onto the canvas, then choose  Bulk Delete to create a Bulk Delete node
  2. Alternatively, drag the  Bulk Delete icon from the toolbar onto the canvas
  3. In the Create Bulk Delete Action window:
    1. Enter a Name
    2. Choose a Type from: 
      1. Delete: allows only records satisfying the specified filter criteria to be deleted
        1. Set the filter criteria in the Bulk Delete Action  Properties under Data Retrieval Options - see section below
      2. Delete All: deletes all data from the selected table 
    3. Choose to Allow Audited Table to display tables with Audit Manual Changes enabled in the Table drop down
      1. By default, tables with Audit Manual Changes enabled are not shown in the Table drop down list
    4. Choose the Table from the drop down where the records will be deleted
      1. Or click the table icon to display tables in the Repository
    5. Select Create Action

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

Setting Delete Action Filter Criteria

Where the Type is set to Delete on the  Bulk Delete action, the Data Retrieval Options section shows in the  Properties. This filter must be set for the Bulk Delete action to run.

  1. Choose a Data Range from:
    1. Latest: selects data from the latest recordsets
    2. All: selects data from all recordsets (default)
  2. Set the Filter Criteria to specify which records will be selected for deletion. See Filter → Filter Details
    1. Incoming attributes mapped to the Bulk Delete node can be referenced in the Data Retrieval Options using the syntax, ConnectorName.AttributeName, e.g. in.MyAttribute

Specify Delete Batch Size

Where the Type is set to Delete on the  Bulk Delete action, in the Advanced section, an optional Delete Batch Size can be set to determine the size of the batches. If left blank the batch size set in System Configuration → System TuningDelete Batch Size, is used as the default. The System Configuration value can be overridden with this batch size. 

Bulk Delete Output Attribute (modifiedRows)

The output attribute, modifiedRows, automatically shows when mapping from a Bulk Delete action. This attribute is a count of the rows that are updated by the action, but if the Type (see above) is set to Delete All then the value is unavailable.


Worked Example

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

In this example, we are using:  

  • Company Rejected Companies screen containing three grids of the Companies, Orders and OrderLines data - this screen was created using the Multi-Tile template

If you are completing this chapter as part of the Actionflow course and using a training instance, the data and screens have already been pre-loaded into the Actionflow Advanced Application. For this example, we'll be working on the Company Rejected Companies screen.

Bulk Delete Rejected Companies

In this example, we'll set up an Actionflow to delete all companies with a Status of Rejected, along with any associated Orders and Order Lines.

View Setup

  1. Open the Company Rejected Companies screen
  2. Create an Actionflow on the Delete All button
    1. Name: BulkDeleteRejectedCompanies
  3. Configure the input connection point to   On Click
  4. Create a   View to the Companies data to output the CompanyID of rejected companies only
  5. Connect the input to the View 
    1.  Checkpoint

Lookup Setup

Create a lookup to the Orders data to retrieve the orderIDs as an array. The orderID can then be used to bulk delete the orders and orderLines. A lookup is used to pass a large block of data (an array) rather than one record at a time.

 How?
  1. Create a  Calculate to process the lookup Orders data
  2. From the Calculate action, create a lookup the Orders data
    1. Request (Incoming) Mappings: CompanyID
    2. Return (Outgoing) Mappings: Order_ID
  3. Create a filter on the Orders   View to only retrieve orders that match the incoming CompanyID
  4. On the Calculate action, create an Output Attribute to process the Order IDs coming from the lookup as structured data
 Checkpoint

Bulk Delete Action Setup

  1. Create three  Bulk Delete actions for deleting from the three tables: Companies, Orders and OrderLines
  2. Map the associated ID attribute into the relevant Bulk Delete node
    1.  How?
      1. Map the following attributes from the Calculate action to the Bulk Delete action specified below:
        1. Delete Companies: CompanyID (from the View)
        2. Delete Orders: OrderID (from the Calculate)
        3. Delete Order Lines: OrderID (from the Calculate)
  3. Set up filters on each node in the Data Retrieval Options section to ensure only records associated with a rejected company are deleted
 How? & Checkpoint

Testing

  1. Return to the Company Rejected Companies screen and lock the screen
  2. Press the Bulk Delete button
  3. Refresh the data in each grid to see the results
  4. Review the Orders and Order Lines data to check there are no orders or order lines with a blank company 

 How to Reinstate Data

Reinstating Data

After testing, you may wish to remove the changes you've made and reinstate your data to use again. Ensure you have downloaded the data from the Learning Centre.

  1. Open the Advanced Actionflow Data Analysis Model
  2. Right-click on a  Table where the data has been changed and select Rollback
    1. Select to Rollback all data
    2. Toggle off Keep Old Recordsets
    3. Click Confirm
  3. To reupload the data in its original form, hover over the table's   File Collector and choose  Upload File
  4. Select the downloaded file on your PC
    1. Click Upload File
  5. Hover over the connected table and choose  Run Analysis
  6. Repeat these steps with all tables where the data has been changed and requires reinstating
  7. Once the data is restored for each table,  Save the Analysis Model