Versions Compared

Key

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

Insert excerpt
_Banners
_Banners
nameactionflow
nopaneltrue

What is a View Action?

The 

Insert excerpt
_action_view
_action_view
nopaneltrue
 action selects and filters additional data to use in an Actionflow. This is useful where the originating screen or component does not include all of the data that required by the Actionflow requiresActionflow

Creating View Actions

  1. Click the 
    Insert excerpt
    _action_view
    _action_view
    nopaneltrue
     icon in the toolbar to display existing tables in the application
    1. Existing tables can be dragged from the Repository onto the canvas - choose
      Insert excerpt
      _action_view
      _action_view
      nopaneltrue
       in the pop-up box to create a View action node
  2. Alternatively, drag the 
    Insert excerpt
    _action_view
    _action_view
    nopaneltrue
     icon from the toolbar onto the canvas and select a primary table to view from the drop down list
HTML Comment
hiddentrue

Insert excerpt
View Node
View Node
nopaneltrue

Worked

Examples

Example

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

We want to be able to add and edit the courses. The first step to doing this is by creating two Open Screen Actionflows. Both will open the same screen containing an input form, but when we are adding a new course, we want an empty input form, and when we are editing an existing course, we want the input form to contain course dataIn this example we will configure an Actionflow to change the Status of a Course when a Teacher's Status is changed, i.e. changing a Teacher's Status to Inactive causes a Course's Status to change to On Hold. SCREENSHOTS?

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 Application. For this example, we'll be working on using the Teacher Management, Course Management screen and opening the Course Teachers Form screen screens.

In this example, we are using:

  • a Course Teacher Management screen containing a grid of the School Courses Teachers data - the screen was created using the Tile with Buttons template
  • a Course Teacher Form screen containing form fields, associated with School Courses Teachers data by a background filter - the screen was created using the Edit Form template

To save the new or edited course, the Save Action on the input form must be configured. See 1.09 Save Action Configuration.

Note: When creating a new screen in PhixFlow, a Grid Actions wizard can configure the Create, Read, Update and Delete (CRUD) actions for you. For the purposes of understanding the mechanics of Actionflows, we will create these manually.

Updating data for one table dynamically updates data in another table
  • a Course Management screen containing a grid of the School Courses data - the screen was created using the Tile with Buttons template

Dynamic Updates Between Tables

Using a View Action, modify the Save Actionflow for the School Teachers data to dynamically retrieve and update the School Courses data.

Setup the View Action

  1. Open the Save Actionflow for the Teachers Form
  2. Click on the input connection point to open the Connector Mappings
  3. Drag the TeacherStatus attribute from the left to the Drag and Drop area on the right 
    1. Click Save
  4. Drag a View Action from the toolbar onto the canvas
    1. Name: Get Courses
    2. Primary Table: choose School Courses 
    3. Select Create Action
  5. Drag and drop the View action you just created onto the in connector between the input node and the Save action
  6. Click on the in connector between the input node and the View node to open the Mappings
  7. Drag both the TeacherID and TeacherStatus attributes from the left to the Drag and Drop area on the right
    1. Select Save
  8. Click on the View Action to open the properties
    1. In the Output Attributres section, select the 
      Insert excerpt
      _attributes_icon
      _attributes_icon
      nopaneltrue
       icon
      1. Drag the CourseID and CourseStatus attributes into the Output Attributes section in the properties
      2. Select OK
    2. In the Data Retrieval Options section, click the 
      Insert excerpt
      _addIcon
      _addIcon
      nopaneltrue
       next to Filter and create a filter:
      1. Name: ByTeacher
      2. Filter Details: 
      3. Select 
        Insert excerpt
        _finish
        _finish
        nopaneltrue
    3. Select 
      Insert excerpt
      _finish
      _finish
      nopaneltrue
       on the properties

Setup the Calculate Action

Create a Calculate Action to alter the CourseStatus based on the TeacherStatus.

  1. Drag a View Action from the toolbar onto the canvas
    1. Name: Change Course Status
    2. Select Create Action
  2. Drag and drop the Calculate action you just created onto the in connector between the View action node and the Save action node
  3. Click on the in connector between the View action node and the Calculate action node
  4. Map across the CourseStatus, TeacherID and TeacherStatus attributes as these are needed for the Calculate action
    1. Select Save
  5. Click on the Calculate action to open its properties
  6. In the output attribute section, click 
    Insert excerpt
    _add_icon
    _add_icon
    nopaneltrue
     to create a new output attribute:
    1. Name: NewCourseStatus
    2. Type: Choose String
    3. Expression: 


      Code Block
      languagejs
      themeEmacs
      // If TeacherStatus is Inactive, set CourseStatus to On Hold
      if(
          in.TeacherStatus == "Inactive", $pfCourseStatus = "On Hold",
      
      // Else, set CourseStatus to Open
          $pfCourseStatus = "Open"
      )


    4. Select 
      Insert excerpt
      _finish
      _finish
      nopaneltrue
Expand
titleCheckpoint

Image Added

Setup an Additional Save Action

As we are modifying the Save Actionflow for the Teachers table, we need an additional Save action to save the NewCourseStatus to the Courses table.

  1. Drag a Save Action from the toolbar onto the canvas
    1. Name: Save Courses
    2. Table: Choose School Courses table
    3. Select Create Action
  2. In the Save Action's properties, toggle on Auto Save Attributes
  3. Hover over the calculate action and select out
  4. When the red arrow shows, click on the Save Courses action node
  5. On the Mappings window:
    1. drag the NewCourseStatus attribute from the left onto the CourseStatus attribute on the right
    2. drag the CourseID attribute from the left onto the CourseID attribute on the right
    3. Select Save