Save Action Configuration
What is a Save Action?
The
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.
For the full list of Save action
Creating Save Actions
On an Actionflow, click the
icon in the toolbar to display any existing tables in the applicationExisting tables can be dragged from the Repository onto the canvas, then choose
to create a Save node
Alternatively, drag the
icon from the toolbar onto the canvasIn the Create Save Action window:
Enter a name
Choose a Type:
Auto Insert/Update: Insert or update records using the following condition:
If the input data passes in the primary key of an existing record, the save action updates the record in the chosen table
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
Insert: Always insert a new record into the chosen table
Update: Always update a record for the chosen table. For a record to update successfully a primary key must be provided.
Choose the Table from the drop down where the records will be inserted or updated
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.
Allocating Primary Key Values to New Records
When the Save action is inserting a new record to the table, PhixFlow allocates a unique primary key value to the record. How PhixFlow allocates a value is determined by the Table properties → Advanced → Primary Key Generator.
Internal: By default, PhixFlow automatically allocates a unique, numeric value to the primary key attribute
Sequence: Configure PhixFlow to allocate a value from your own sequence using the Primary Key Generator Sequence option, see Data Generation Options and Sequence
Show Views and Recordsets
Right-click on a
Field | Description |
|---|---|
Show the list of views for the backing table. | |
Shows the list of recordsets for the backing table. See Managing Recordsets. |
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.
On the screen where the Actionflow will be initiated from, Course Form, right-click on the
button and choose
Enter a name for the Actionflow,
Name:
Save CourseSelect Confirm
Select Click to Connect under Connections and for the input, choose the Course
data source, then select Connect InputIn 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)
Select Save
Click and drag the
icon from the toolbar onto the canvasIn the Create Save Action window enter:
Name:
SaveCourseType: choose Auto Insert/Update
Table: choose School_Courses
Select Create Action
Click and drag the
icon onto theaction nodeRight-click on the in connector between the
andaction node, and chooseDrag the CourseID attribute on the left onto the CourseID attribute on the right
Select Save
Click on the
action node and in the, toggle onAuto Save Attributes- the properties tab
Finally, in the Settings above the canvas, toggle on
Close screen after action completes
CheckpointClose the Actionflow and return to the Course Management screen
- the screen and click or to open the Course Form
Enter/change the course details, then press
to see the Actionflow in action
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