Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Insert excerpt
_Banners
_Banners
nameactionflow
nopaneltrue

By the end of this chapter you will understand what a Save action is and how to use them, and you will have created a Save Actionflow in your application.

What is a Save Action?

The 

Insert excerpt
_action_save
_action_save
nopaneltrue
 action inserts or updates records in a selected table. 

Save actions only save attributes mapped into them. NOT SURE WE SHOULD LEAD WITH THIS However, if the Save action has Auto Save Attributes enabled, this saves unmapped attributes from the input form or view, matched by identifier. This finds the attribute associated with a field that was created by dropping the attribute onto a form.

Note: Save actions must be attached to a table with a Type of Transactional. Reword? "Save actions will only insert or update records in tables with the Type of Transactional."

Creating Save Actions

  1. Click the 
    Insert excerpt
    _action_save
    _action_save
    nopaneltrue
     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 
      Insert excerpt
      _action_save
      _action_save
      nopaneltrue
      to create a Save node
  2. Alternatively, drag the 
    Insert excerpt
    _action_save
    _action_save
    nopaneltrue
     icon from the toolbar onto the canvas
  3. In the Create Save Action window:
    1. Enter a name
    2. Choose a Type:
      1. Auto Insert/Update - Insert or update records using the following condition:
        1. If the input data passes in the primary key of an existing record, the save action updates the record in the chosen table
        2. If the input data does not pass in the primary key of an existing record, the save action inserts a new record in the chosen table
      2. Insert - Always insert a new record into the chosen table
      3. Update - Always update a record for the chosen table. For a record to update successfully a primary key must be provided.
    3. Choose the Table from the drop down where the records will be inserted or updated
    4. Select Create Action
HTML Comment
hiddentrue

Insert excerpt
Save Node
Save Node
nopaneltrue

Worked Example

Here's a worked example using the School Data (available from the Learning Centre). WHAT DOES IT SHOW?

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 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.

Save Action to Add and Edit Data

  1. On the Course Management screen, press either the  or  button to open the Course Form
  2. Right-click on the button and choose 
    Insert excerpt
    _actionflow_add
    _actionflow_add
    nopaneltrue
  3. Enter a name for the Actionflow,
    1. Name: Save Course
    2. Select Confirm
  4. Select Click to Connect and for the input, choose the Course 
    Insert excerpt
    _form
    _form
    nopaneltrue
     datasource, then select Connect Input
  5. In the Mappings window that opens, drag the CourseID attribute from the left (Course Form) to the right (Input Connection Point)
    1. Select Save
  6. Click and drag the 
    Insert excerpt
    _action_save
    _action_save
    nopaneltrue
     icon from the toolbar onto the canvas
  7. In the Create Save Action window enter:
    1. Name: SaveCourse
    2. Type: choose Auto Insert/Update
    3. Table: choose School_Courses
    4. Select Create Action
  8. Click and drag the 
    Insert excerpt
    _driving_interface_connection_point
    _driving_interface_connection_point
    nameicon
    nopaneltrue
     icon onto the 
    Insert excerpt
    _action_save
    _action_save
    nopaneltrue
     action node
  9. Right-click on the in connector and choose Open Mappings
    1. Drag the CourseID attribute on the left onto the CourseID attribute on the right
    2. Select Save
  10. Click on the Save action node and in the 
    Insert excerpt
    _property_settings
    _property_settings
    nopaneltrue
    , toggle on 
    Insert excerpt
    _toggle_on
    _toggle_on
    nopaneltrue
     Auto Save Attributes
  11. Finally, in the Settings above the canvas, toggle on 
    Insert excerpt
    _toggle_on
    _toggle_on
    nopaneltrue
     Close screen after action completes
  12. Close the Actionflow to return to the Course Management screen
  13. Insert excerpt
    _lock
    _lock
    nopaneltrue
     the screen and press the or  button
  14. Either enter new course details or edit the existing course details and press  to see the Actionflow in action
    1. We can see that the Actionflow is working because the grid is updated with the data we have just created/edited 

SCREEN SHOT OF WHAT WAS CREATED?