Versions Compared

Key

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

Insert excerpt
_Banners
_Banners
nameactionflow
nopaneltrue

2. Setting

Worked Example

Unhide string form field, StudentIDFromAttendees.

Lookup to Retrieve Data

We will create an Actionflow containing a Calculate Action and a View Lookup Action. The Calculate Action will allow the input data to pass through into the View Action where it will be used to lookup to the Course Attendees table to find the students attending the courses.

What is a Lookup?

Image Added

Lookups are denoted by a dotted double-ended connector transferring data into and out of a 

Insert excerpt
_action_view
_action_view
nopaneltrue
 Action, and are used to lookup and retrieve records in other recordsets. Lookup views require:

  • Incoming Mappings: the attributes being passed into the View Action via the lookup connector
  • Output Attributes: the attributes being used by the View Action to filter the results
  • Outgoing Mappings: the attributes being passed out of the View Action via the lookup connector 


Expand
titleViews vs Lookups

Insert excerpt
1.15 View Action Configuration
1.15 View Action Configuration
nameLookupVsView
nopaneltrue

Creating Lookups

Iframe
allowfullscreentrue
srchttps://www.youtube.com/embed/2gwSPS8exxA?si=o14CBebFWw42bSIG?&rel=0&ytp-pause-overlay
width680
alignmiddle
height400

  1. Hover over an action node, e.g. a Calculate Action, on the canvas and select Image Added
  2. Enter a name for the Lookup Connector
  3. Click onto a 
    Insert excerpt
    _action_view
    _action_view
    nopaneltrue
     
    action on the canvas
  4. Alternatively, click onto any empty space on the canvas to create a new 
    Insert excerpt
    _action_view
    _action_view
    nopaneltrue
     Action


Worked Example

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

In this example, we are using:

  • Classroom Management screen  - this screen was created using the Tile with Buttons template, and contains:
    • A basic card container of the Classroom data
    • A basic card container of the Courses data
    • An empty string field, FilterField
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 working on the Classroom Management screen. 

Lookup to Classroom Courses

In this example, we want to see the courses held in each classroom when each classroom is clicked. To do this, we will use the classroom data to lookup and retrieve the associated courses data, then output that data back to the screen where it can be used to filter the courses data.

Image Added

To do this it we will:

  • lookup Lookup the courses using the Course Classroom ID, which is found on both the Course and Attendees tablesuse the Course ID on the Attendees table to find the corresponding Student ID(s) of the students attending that course Classroom and Course tables
  • Write those Student courses' Course ID(s) back to the screen onto a string field
  • Setup a background filter that to only show students courses in a Students grid Courses card container that match the Student Course ID in the field

Image Removed

Create Calculate Action and View Action

  • Add a button to the Tile - Footer area beneath the school courses grid
    1. Name: Enrolled Students
  • Right-click on the button and choose 

    Event Handler Setup

    Event handlers facilitate actions occurring in response to a user action. For this example, we want a user clicking on a classroom card to run an Actionflow that populates a string field that we will later to use to filter the information that can be seen on screen

    1.  Click on the top card on the Classroom Management screen to open the 
      Insert excerpt
      _property_settings
      _property_settings
      nopaneltrue
       for the area, Card
    2. Click on the 
      Insert excerpt
      _property_tabs
      _property_tabs
      nameaction
      nopaneltrue
    3. Click the 
      Insert excerpt
      _add_
      actionflow
      icon
      _add_icon
      _actionflow_add
      nopaneltrue
       icon in the Event Handler section
    4. In the New Card (On Click) Event Handler tab, click 
      Insert excerpt
      _save
      _save
      nopaneltrue
      1. Enter a name for the Actionflow
      ,
      1. :
        1. Name:
        Find StudentsSelect Confirm
        1. Filter Courses

    Image Added

    Create Calculate Action and Lookup

    1. Select Click to Connect and for the input, choose the School Course  Insert excerpt_grid_gridnopaneltrue data sourceClassrooms Card Component, then select Connect InputInput   
    2. In the Mappings window that opens, drag the CourseID ClassroomID attribute from the left to the right
      1. Select Save
    3. Click and drag the 
      Insert excerpt
      _action_calculate
      _action_calculate
      nopaneltrue
       icon from the toolbar onto the canvas
    4. In the Create Calculate Action window enter:
      1. Name: FindStudents GetCourses
      2. Select Create Action

        Note

        The Calculate Action will be configured below as it is needed for the output. For the input data, the attributes pass through the Calculate action without being processed. For the output data, the Calculate action processes the data into an array. 


    5. Click and drag the 
      Insert excerpt
      _driving_interface_connection_point
      _driving_interface_connection_point
      nameicon
      nopaneltrue
       icon onto the 
      Insert excerpt
      _action_calculate
      _action_calculate
      nopaneltrue
       action node
    6. Right-click on the in connector and choose
      Insert excerpt
      _open_mappings
      _open_mappings
      nopaneltrue
      1. Drag the CourseID ClassroomID attribute on the left onto the Drag and Drop area on the right
      2. Select Save
    7. To lookup look up to the Course Attendees table, we need to create a View ActionClick and drag School_Courses table, hover over the 
      Insert excerpt
      _action_viewcalculate
      _action_viewcalculate
      nopaneltrue
       icon from the toolbar onto
       action node and choose, Add Lookup
      1. On the Add Connection Point window, name the lookup: luc
        1. We recommend choosing a name to indicate the action taking place, e.g. "luc" for look up courses
      2. Click Confirm
    8. With the red arrow attached to your mouse, click anywhere on the canvas
    9. In the Create View Action window enter:
      1. Name: GetStudentIDCourses
      2. Primary Table: choose the Course Attendees data School_Course 
      3. Select Create Action

    Expand
    titleCheckpoint

    Image Removed

    Configure the

    Lookup on the View Action 
  • Hover over the calculate action and select Image Removed
  • Enter a name for the lookup connector:
    1. Name: lu
    2. Select Confirm
    3. When the red arrow shows, click on the View Action on the canvas
  • Select the View Action on the canvas to open the properties
  • In the Output Attributes section, click on the  Insert excerpt_attributes_icon_attributes_iconnopaneltrue icon 
    1. In the Available Attributes window, drag StudentID into the Output Attributes section of the properties
    2. Click OK
  • Select the lu connector to map the incoming and outgoing data
  • For the Incoming Mappings:Drag the CourseID

    Lookup 

    1. The Output Attribute Selection window will open automatically 
      1. Click the tick box next to CourseID
      2. Click Next
    2. The Incoming Mappings window will open automatically
      1. Drag the ClassroomID attribute from the left (Calculate Action) into the Drag and Drop area on the right to create a corresponding attribute in the View Actionthe 
        Insert excerpt
        _action_view
        _action_view
        nopaneltrue
         action
      2. Select Next
    3. For the The Outgoing Mappings :window will open automatically
      1. Drag the StudentID CourseID attribute from the left (View Action) to the Drag the Drag and Drop area on the right to create map a corresponding attribute back to the Calculate Action
      2. Right-click on the StudentID attribute you just created and rename it
        1. Image Removed
      3. Click Confirm
        Insert excerpt
        _action_calculate
        _action_calculate
        nopaneltrue
         action
        1. Image Added
      4. Click Confirm and Create Filter
    4. We need to filter the data coming out of the lookup 
      1. Click on the View Action to open its properties
      2. In the Data Retrieval Options section, click the  Insert excerpt_addIcon_addIconnopaneltrue icon next to Filter
        1. Name: ByCourseID
        2. Filter Details: Image RemovedName: ByClassroomID
        3. Click abc to tell PhixFlow to interpret the field as an expression
        4. Filter Conditions: Image Added
          1. In this filter, the top CourseID is from the Courses data, and the bottom CourseID is from the Classroom data  
        5. Select Finish
      Expand
      titleCheckpoint

      Image Added

      Configure the Calculate Action and Output

      1. Click on the
        Insert excerpt
        _
        finish
        action_calculate
        _action_
        finish
        calculate
        nopaneltrue
         the Filter tab action on the canvas to open its
        Insert excerpt
        _property_
        save
        tabs
        _property_
        save
        tabs
        nopaneltrue
         the View Action tab
      Expand
      titleCheckpoint

      Image Removed

      Configure the Calculate Action and Output

      1. Click on the Calculate Action on the canvas to open its properties
      2. In the Output Attributes section, click the 
        Insert excerpt
        _addIcon
        _addIcon
        nopaneltrue
         icon to create a new attribute:
        1. Name: CourseStudentIDs CourseIDArray
        2. Type: Choose Structured Data Data   
          1. This will return the results as an array

        3. Expression: 


          Code Block
          languagejs
          themejavaEmacs
          luluc.StudentIDFoundCourseID


        4. Click 

          Insert excerpt
          _finish
          _finish
          nopaneltrue

      3. Under Connections on the left, select 

        Insert excerpt
        _addIcon
        _addIcon
        nopaneltrue
         Add

      4. Add an

        output connection point. name: out

        Output Connection Point:

        1. Name: output
        2. Type: choose Output

        3. Click Create Connection Point
      5. Select Click to Connect and choose the In the Connect Output window, choose the ClassroomAvailabilityManagement 
        Insert excerpt
        _form
        _form
        nopaneltrue
         datasource, then Connect Output
        1. Close the mappings Mappings window that opens as we don't have any attributes to map to this yet
      6. Hover your mouse over the Calculate Action
        Insert excerpt
        _action_calculate
        _action_calculate
        nopaneltrue
         action on the canvas and click out
      7. When the red arrow shows, click on the output node the 
        Insert excerpt
        _output
        _output
        nameicon
        nopaneltrue
         node under Connections
        1. On the Mappings window, drag across the
        CourseStudentIDs output attribute
        1. CourseIDArray attribute from the Calculate
        Action Action into
        1. action into the Drag and Drop area on the right to create a corresponding attribute
        in
        1. on the output
        2. Click Save
      8. Click the out output connection point, under Connections
        1. On the Mappings window, drag
        the CourseStudentIDs output attribute
        1. the CourseIDArray attribute from the output to the string field
        on the screen
        1. ,
        StudentIDFromAttendees
        1. FilterField
        2. Click Save
      9. The Actionflow is now built
      Setup
      Expand
      titleCheckpoint

      Image Added

      Setting up a Background Filter

      The Event Handler and Actionflow will now populate the string field, StudentIDFromAttendees, but , FilterField, by clicking each classroom card, but the Courses card container needs a background filter setting so it can be filtered by the values in this field need to be linked to the Students grid using a background filter in order to only see the students for the selected course.

    5. Return to the screen containing the school courses grid
    6. Right-click on the Students grid and choose 

      the string field.

      Expand
      titleTroubleshooting

      Anchor
      troubleshooting
      troubleshooting

      Note

      If at any point your screen does not display the expected results, such as clicking on the classroom card does not populate FilterField, or after creating the below filter the Courses cards do not filter, always try closing and reopening the screen first.


      1. Return to the Classroom Management screen 
      2. Click on the Courses card container to open the Card Component 

        Insert excerpt
        _property_settings
        _property_settings
        nopaneltrue
         

        1. Ensure you click on the white space underneath the top contact card to open the Card Component
      3. On the 

        Insert excerpt
        _

        view

        property_

        show_config

        tabs
        _

        view

        property_

        show_config

        tabs
        nopaneltrue

        In the Data Retrieval Options, next to

        , in the Background Filter Rules section, click 

        Insert excerpt
        _addIcon
        _addIcon
        nopaneltrue

        1. Name: ByStudentID
        2. Filter Details: Image RemovedEnter the Rule Expression: true
      4. Create a new filter by pressing 
        Insert excerpt
        _addIcon
        _addIcon
        nopaneltrue
         next to Filter:
        1. Name: ByFilterField
        2. In the Filter Details section, click Select an option and choose the CourseID in the Table Attributes
        3. Filter Details: Image Added
        1. Click 
          Insert excerpt
          _finish
          _finish
          nopaneltrue
           on both the Filter and Filter Rule 
          Insert excerpt
          _property_settings
          _property_settings
          nopaneltrue
      5. Insert excerpt
        _lock
        _lock
        nopaneltrue
         the screen and click a classroom card to see the Actionflow working

      Having trouble? See Troubleshooting above.

      Tip

      Once you have verified the Actionflow is working, the FilterField string field can be hidden in the 

      Insert excerpt
      _property_tabs
      _property_tabs
      namestyle
      nopaneltrue
       or 
      Insert excerpt
      _layers
      _layers
      nopaneltrue
       to tidy up the screen.


      Image Modified