Insert excerpt | ||||||||
---|---|---|---|---|---|---|---|---|
|
What is a Save Action?
The
action inserts or updates records into a specified table. Insert excerpt _action_save _action_save nopanel true
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 | |||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||||||||||||||||||||||
|
Creating Save Actions
- On an Actionflow, click the
icon in the toolbar to display any existing tables in the applicationInsert excerpt _action_save _action_save nopanel true - Existing tables can be dragged from the Repository onto the canvas, then choose
to create a Save nodeInsert excerpt _action_save _action_save nopanel true
- Existing tables can be dragged from the Repository onto the canvas, then choose
- Alternatively, drag the
icon from the toolbar onto the canvasInsert excerpt _action_save _action_save nopanel true - 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.
- Auto Insert/Update: Insert or update records using the following condition:
- Choose the Table from the drop down where the records will be inserted or updated
- Select Create Action
Excerpt | ||||||
---|---|---|---|---|---|---|
| ||||||
Create Actionflow using Form Actions WizardAfter 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 to a Delete button, or drag anywhere on the screen to create the button(s) automatically.
|
HTML Comment | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
|
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
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. |
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
Insert excerpt _actionflow_add _actionflow_add nopanel true - Enter a name for the Actionflow,
- Name:
Save Course
- Select Confirm
- Name:
- Select Click to Connect under Connections and for the input, choose the Course
data source, then select Connect InputInsert excerpt _form _form nopanel true - 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)
- Select Save
- Click and drag the
icon from the toolbar onto the canvasInsert excerpt _action_save _action_save nopanel true - In the Create Save Action window enter:
- Name:
SaveCourse
- Type: choose Auto Insert/Update
- Table: choose School_Courses
- Select Create Action
- Name:
- Click and drag the
icon onto theInsert excerpt _driving_interface_connection_point _driving_interface_connection_point name icon nopanel true
action nodeInsert excerpt _action_save _action_save nopanel true - Right-click on the in connector between the
andInsert excerpt _input _input nopanel true
action node, and chooseInsert excerpt _action_save _action_save nopanel true 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
action node and in theInsert excerpt _action_save _action_save nopanel true
, toggle onInsert excerpt _property_settings _property_settings nopanel true
Auto Save AttributesInsert excerpt _toggle_on _toggle_on nopanel true
the properties tabInsert excerpt _finish _finish nopanel true Finally, in the Settings above the canvas, toggle on
Close screen after action completesInsert excerpt _toggle_on _toggle_on nopanel true Expand title Checkpoint - Close the Actionflow and return to the Course Management screen
the screen and click or to open the Course FormInsert excerpt _lock _lock nopanel true - 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