1.09 Save Action Configuration

What is a Save Action?

The  Save action inserts or updates records into a specified table. 

If the Save action has Auto Save Attributes enabled, this saves unmapped attributes from the input form or view, matched by the primary key. The primary key must be mapped. Where it is empty, a new record is inserted but if it is populated, the existing record is updated.

Note: Save actions will only insert or update records in tables with a 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 Save Actions

  1. On an Actionflow, click the  Save 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  Save to create a Save node
  2. Alternatively, drag the  Save 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

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.

Worked Example

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

In this example, we are using:

  • A Course Form screen containing form fields and associated with School Courses data by a background filter - the 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, the data and screens have already been pre-loaded into the Actionflow Foundation Application. For this example, we'll be configuring a button on the Course Form screen.

We want to be able to save new courses and edit existing ones on a Course Management screen. To do this, we will configure a Save Action on an input form, Course Form screen, that saves the data to the School Courses table. 

Save Action to Add and Edit Data

Create a Save Action to save data to the school courses table.

  1. On the screen where the Actionflow will be initiated from, Course Form, right-click on the button and choose  Add Actionflow
  2. Enter a name for the Actionflow,
    1. Name: Save Course
    2. Select Confirm
  3. Select Click to Connect under Connections and for the input, choose the Course  Form data source, then select Connect Input
  4. In the Mappings window that opens, drag the CourseID attribute from the left (Course Form) into the Drag and Drop area on right (Input Connection Point)
    1. Select Save
  5. Click and drag the  Save icon from the toolbar onto the canvas
  6. 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
  7. Click and drag the  icon onto the  Save action node
  8. Right-click on the in connector between the  input and  Save action node, and choose  Open Mappings
    1. Drag the CourseID attribute on the left onto the CourseID attribute on the right
    2. Select Save
  9. Click on the  Save action node and in the  Properties, toggle on  Auto Save Attributes
  10.  Apply and Close the properties tab
  11. Finally, in the Settings above the canvas, toggle on  Close screen after action completes

     Checkpoint

  12. Close the Actionflow and return to the Course Management screen
  13.  Lock the screen and click  or  to open the Course Form
  14. Enter/change the course details, then press  to see the Actionflow in action
    1. We can see that the Actionflow is working because the School Courses grid on the Course Management screen is updated with the data we have just created/edited