View Action Configuration

View Action Configuration

What is a View Action?

The 

 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 required by the Actionflow. 

For the full list of View action

, see View Action Properties.

Views vs Lookups

.

There are two kinds of View.

For more information on lookups, see Lookup Configuration, or see how-to guide, Lookups with Dynamic Parameters.

Creating View Actions

  1. Click the 

     icon in the toolbar to display existing tables in the application

    1. Existing tables can be dragged from the Repository onto the canvas - choose

       in the pop-up box to create a View action node

  2. Alternatively, drag the 

     icon from the toolbar onto the canvas and select a primary table to view from the drop down list

Example Uses

 actions are useful in these example scenarios.

Example: Many Attributes are Needed in the Actionflow

Solution: Rather than map all of these attributes into the Actionflow, the primary key can be mapped in and a

 used to access all of the other attributes.

Example: Not all Attributes are Displayed on the Screen

Solution: Where attributes from the table are needed in the Actionflow but are not displayed on the screen,

s can be used to access all of the attributes in the table.

Troubleshooting

  • If a 

    action returns 0 records, any subsequent action nodes will not run

    • For example, if an Actionflow is run containing a 

      action connected to an
      action, and the view action returns 0 records, the screen will not open

Worked Example

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

In this example, we are using:

  • A Teacher Management screen containing a grid of the School Teachers data - the screen was created using the Tile with Buttons template

  • A Teacher Form screen containing form fields and associated with School Teachers data by a background filter - the screen was created using the Edit Form template

  • A Course Management screen containing a grid of the School Courses data - the screen was created using the Tile with Buttons 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 added extra functionality to a button on the Teacher Form.

We want the status of a course to be dynamically updated to On Hold if the associated teacher's status is changed to Inactive. To do this, we will add

 and
 actions to a Save Actionflow.

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.

Configure a View Action

Create a View Action to access the School Courses data within an Actionflow for the School Teachers data.

  1. Open the

     Save Actionflow for the Teacher Form

  2. Right-click on the input connection point, under Connections, and select 

  3. Drag the TeacherStatus attribute from the left into the Drag and Drop area on the right 

    1. Click Save

  4. Drag a

     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 Get Courses 

    Action onto the in connector between the
     Node and the
     Action

  6. Click on the in connector between the 

     node and the 
    Action to open the Mappings

  7. Drag both the TeacherID and TeacherStatus attributes (hold Ctrl to multi-select) from the left into the Drag and Drop area on the right

    1. Select Save

  8. Click on the Get Courses 

     Action to open its 

    1. In the Output Attributes section, select the 

       icon

      1. Drag the CourseID and CourseStatus attributes into the Output Attributes section in the

      2. Select OK

    2. In the Data Retrieval Options section, click the 

       next to Filter and create a filter:

      1. Name: ByTeacher

      2. Filter Details: 

        1. Click abc to tell PhixFlow to interpret the field as an expression

      3. Select 

    3. Select 

       on the

Checkpoint

Configure a Calculate Action

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

  1. Drag a 

     Action from the toolbar onto the canvas

    1. Name: Change Course Status

    2. Select Create Action

  2. Drag and drop the Change Course Status 

     action onto the in connector between the 
     action and the
     action

  3. Click on the in connector between the 

     action and the 
     action to open the Mappings

  4. Map across the CourseStatus, TeacherID and TeacherStatus attributes, as these are needed for the 

     action

    1. Select Save

  5. Click on the 

     action to open its 
     

  6. In the Output Attribute section, click 

     to create a new attribute:

    1. Name: NewCourseStatus

    2. Type: Choose String

    3. Expression: 

      // 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 

Checkpoint

Configure an Additional Save Action

As we are modifying the Save Actionflow for the Teachers table, we need an additional

 Action to save the NewCourseStatus to the Courses table.

  1. Drag a

     Action from the toolbar onto the canvas

    1. Name: Save Courses

    2. Table: Choose the School Courses table

    3. Select Create Action

  2. In the 

     Action's Properties, toggle on
     Auto Save Attributes

  3. Select

  4. Hover over the 

     action and select out

  5. When the red arrow shows, click on the 

     Courses action node

  6. 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

      Checkpoint

  7. Close the Actionflow and return to the Teacher Management screen

  8.  the screen and select a record to Edit

  9. On the Teacher Form, change the teacher's Status to Inactive and press Save

    1. To see that the Actionflow has worked, open the Course Management screen

    2. Any course(s) assigned to the teacher you just updated should have a Status of On Hold