What is a Save Action?
The Insert excerpt |
---|
| _action_save |
---|
| _action_save |
---|
nopanel | true |
---|
|
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.
Excerpt |
---|
|
Expand |
---|
title | How to check a table's period |
---|
| The table periods are:
To check the period of a table: - Find the table in the
Insert excerpt |
---|
| _repository |
---|
| _repository |
---|
nopanel | true |
---|
|
- Right-click it, then choose
- On the table's
Insert excerpt |
---|
| _property_tabs |
---|
| _property_tabs |
---|
nopanel | true |
---|
| , in the Analysis Options section, the Period drop down can be found
Image Modified |
|
Creating Save Actions
- Click the
Insert excerpt |
---|
| _action_save |
---|
| _action_save |
---|
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 |
---|
| _action_save |
---|
| _action_save |
---|
nopanel | true |
---|
|
to create a Save node
- Alternatively, drag the
Insert excerpt |
---|
| _action_save |
---|
| _action_save |
---|
nopanel | true |
---|
|
icon from the toolbar onto the canvas - In 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
HTML Comment |
---|
|
Insert excerpt |
---|
| Save Node |
---|
| Save Node |
---|
nopanel | true |
---|
|
|
Worked Example
Here's a worked example using the School Data (available from the Learning Centre).
We want to be able to save new courses and edit existing ones. To do this, we will configure a Save Action on an input form that saves the data to the table. GIFIn 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
Tip |
---|
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. |
In this example, we are using:
- a Course Form screen containing form fields, associated with School Courses data by a background filter - the screen was created using the Edit Form template
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.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. GIF
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 screen, right right-click on the button and choose
Insert excerpt |
---|
| _actionflow_add |
---|
| _actionflow_add |
---|
nopanel | true |
---|
|
- Enter a name for the Actionflow,
- Name:
Save Course
- Select Confirm
- Select Click to Connect under Connections and for the input, choose the Course data source, then select Connect Input
- In the Mappings window that opens, drag the CourseID attribute from the left (Course Form) to the right (Input Connection Point)
- Select Save
- Click and drag the
Insert excerpt |
---|
| _action_save |
---|
| _action_save |
---|
nopanel | true |
---|
|
icon from the toolbar onto the canvas - In the Create Save Action window enter:
- Name:
SaveCourse
- Type: choose Auto Insert/Update
- 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_save |
---|
| _action_save |
---|
nopanel | true |
---|
|
action node - Right-click on the in connector and choose
Insert excerpt |
---|
| _open_mappings |
---|
| _open_mappings |
---|
nopanel | true |
---|
|
- Drag the CourseID attribute on the left onto the CourseID attribute on the right
- Select Save
- Click on the Save action node and in the
Insert excerpt |
---|
| _property_settings |
---|
| _property_settings |
---|
nopanel | true |
---|
|
, toggle on Insert excerpt |
---|
| _toggle_on |
---|
| _toggle_on |
---|
nopanel | true |
---|
|
Auto Save Attributes - Finally, in the Settings above the canvas, toggle on
Insert excerpt |
---|
| _toggle_on |
---|
| _toggle_on |
---|
nopanel | true |
---|
|
Close screen after action completes
Expand |
---|
|
|
- Close the Actionflow to and return to the Course Management screen
- Either enter new course details or edit the existing course details and Click Image Added or Image Added to open the Course Form and 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
SCREEN SHOT OF WHAT WAS CREATED?