By the end of this chapter you will understand what a Delete action is and how to use them, and you will have created a Delete Actionflow in your application.
What is a Delete Action?
The Insert excerpt |
---|
| _delete |
---|
| _delete |
---|
nopanel | true |
---|
|
delete action deletes records for a selected table.
Note: Delete actions Delete actions will only insert or update delete records in tables with the Type of TransactionalPeriod of Transactional.
Insert excerpt |
---|
| Save Action Configuration |
---|
| Save Action Configuration |
---|
name | TablePeriod |
---|
nopanel | true |
---|
|
For the full list of Delete action Insert excerpt |
---|
| _property_settings |
---|
| _property_settings |
---|
nopanel | true |
---|
|
, see Delete Action Properties.
Creating Delete Actions
- Click the
Insert excerpt |
---|
| _delete |
---|
| _delete |
---|
nopanel | true |
---|
|
icon in the toolbar to display any existing tables in the application- Existing tables can be dragged from the Repository onto the canvas, then choose
Insert excerpt |
---|
| _delete |
---|
| _delete |
---|
nopanel | true |
---|
|
to create a Delete node
- Alternatively, drag the
Insert excerpt |
---|
| _delete |
---|
| _delete |
---|
nopanel | true |
---|
|
icon from the toolbar onto the canvas - In the Create Delete Action window:
- Enter a name
- Choose the Table from the drop down where the records will be inserted or updateddeleted
- Select Create Action
HTML Comment |
---|
|
Need to create a page on the Delete node properties. |
Worked ExampleCreating Delete Actions for File Tables
These settings are in addition to the steps above.
Expand |
---|
Insert excerpt |
---|
| Delete Action Properties |
---|
| Delete Action Properties |
---|
name | FileTidyUp |
---|
nopanel | true |
---|
|
|
Insert excerpt |
---|
| Save Action Configuration |
---|
| Save Action Configuration |
---|
name | FormActions |
---|
nopanel | true |
---|
|
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 Confirmation Message Configuration and 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:
- A Course Management screen containing a grid of the School Courses data - this screen was created using the Tile with Buttons template
- A 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
Save Action to Add and Edit Data Tip |
---|
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 Application. |
Earlier in this course we created two Open Screen Actionflows that open an input form for adding and editing courses to the School Courses grid. In this example we will configure the Save action.
Note: When creating a new input form in PhixFlow, a Form Actions wizard can configure the Save Record and Delete Record actions for you. For the purposes of understanding the mechanics of Actionflows, we will create these manually.
For 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.
Image Added
- On the Course Management screen, press either the Image Removed or Image Removed button to open the Course Form Rightright-click on theImage Removedthe Image Added button and choose
Insert excerpt |
---|
| _actionflow_add |
---|
| _actionflow_add |
---|
nopanel | true |
---|
|
- Enter a name for the Actionflow,
- Name:
Save Delete Course (Course Grid)
- Select Confirm
- Select Click to Connect under Connections and for the input, choose the Course School Courses
Insert excerpt |
---|
| _formgrid |
---|
| _formgrid |
---|
nopanel | true |
---|
|
datasource View Component, then select Connect Input - In the Mappings window that opens, drag notice that by default the data being used is the selected record
- Drag the CourseID attribute from the left (
Course Form) to - School Courses Grid) into the Drag and Drop area on the right (Input Connection Point)
- Image Added
- Select Save
- Click and drag the
Insert excerpt |
---|
| _action_savedelete |
---|
| _action_savedelete |
---|
nopanel | true |
---|
|
icon from the toolbar onto the canvas - In the Create Save Delete Action window enter:
- Name:
SaveCourse
Type: choose Auto Insert/Update DeleteCourse
- Table: choose School _ Courses
- Select Create Action
- Click and drag the
Insert excerpt |
---|
| _driving_interface_connection_point |
---|
| _driving_interface_connection_point |
---|
name | icon |
---|
nopanel | true |
---|
|
icon onto the Insert excerpt |
---|
| _action_savedelete |
---|
| _action_savedelete |
---|
nopanel | true |
---|
|
action node on the canvas - Right-click on the in connector and choose Open MappingsDrag
Insert excerpt |
---|
| _open_mappings |
---|
| _open_mappings |
---|
nopanel | true |
---|
|
- Select Map by Name to map the CourseID attribute on the left onto the CourseID attribute on the right
Select Save
Click on the Save action node and in the
Checkpoint
Image Added
- Close the Actionflow to return to the Course Management screen
- the screen and select a record in the grid, then press the Image Added button
Create a Delete Action to delete courses in the School Courses grid on the Course Form screen.
Image Added
- On the Course Management screen, select the Image Added or Image Added button to open the Course Form
- property_settingsproperty_settings, toggle on the screen
- Right-click on the Image Added button on the Course Form and choose
Insert excerpt |
---|
| _toggleactionflow_onadd |
---|
| _toggleactionflow_onadd |
---|
nopanel | true |
---|
|
Auto Save AttributesFinally, in the Settings above the canvas - Enter a name for the Actionflow,
- Name:
Delete Course (Course
Form)
- Click Confirm
- Repeat the above steps to configure the Actionflow but make the following changes:
- the input is the Course
in the Settings, toggle on Insert excerpt |
---|
| _toggle_on |
---|
| _toggle_on |
---|
nopanel | true |
---|
|
Close screen after action completes
Close the Actionflow to - this will close the Course Form when Image Added is pressed
Checkpoint
Image Added
- Once you have configured the Actionflow, return to the Course Management screen
- the screen, select a record in the grid and press the Image Removedor the button
- Either enter new course details or edit the existing course details and press Image Removed to see the Actionflow in actionOn the Course Form, press the Image Added button
- 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 is updated with the data we have just created/edited
--
Link to confirmation help page here.
Tip |
---|
title | 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. |
Image Modified