Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 19 Next »

What is a Lookup?

Lookups are denoted by a dotted double-ended connector transferring data into and out of a   View 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 View Action to filter results
  • Outgoing Mappings: the attributes being passed out of the View Action via the lookup connector 


 Views vs Lookups

Error rendering macro 'excerpt-include' : No link could be created for '1.15 View Action Configuration'.

Creating Lookups

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

Worked Example

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

In this example, we are using:

  • Course Management screen containing  - this screen was created using the Tile with Buttons template, and contains:
    • A grid of the School Courses data
    • A contacts card container of the School Students data
    • An empty string field, StudentIDFromAttendees

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 expandable tile on the Course Management screen. 

Lookup to Retrieve Data

We will create an Actionflow containing a  Calculate Action and a   View 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 Student IDs of the students attending a course

The Actionflow will output the Student IDs from the Attendees data to a string field, where we will set up a background filter that uses the string field to filter a contacts card container of Students to show only those attending the course.

To do this it we will:

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

Screen Setup

  1.  Lock your screen to expand the Students contacts card container on the right, shown by the tile with chevron
  2.  Unlock your screen and click  Palette in the toolbar to open the Serene Grey palette 
  3. Expand Buttons - Secondary and add a custom button to the Tile - Footer area beneath the School Courses grid
    1. Name: Enrolled Students
  4. Using the  Layers, hold down shift to move the button into the area, Right

Create Calculate Action and View Action

  1. Right-click on the Enrolled Students button and choose  Add Actionflow
  2. Enter a name for the Actionflow:
    1. Name: Find Students
    2. Select Confirm
  3. Select Click to Connect and for the input, choose the School Course  Grid View Component, then select Connect Input
  4. In the Mappings window that opens, drag the CourseID attribute from the left to the right
    1. Select Save
  5. Click and drag the  Calculate icon from the toolbar onto the canvas
  6. In the Create Calculate Action window enter:
    1. Name: FindStudents
    2. Select Create Action

      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. 

  7. Click and drag the  icon onto the  Calculate action node
  8. Right-click on the in connector and choose  Open Mappings
    1. Drag the CourseID attribute on the left onto the Drag and Drop area on the right
    2. Select Save
  9. To look up to the Course Attendees table, we need to create a   View Action
  10. Click and drag the   View icon from the toolbar onto the canvas
  11. In the Create View Action window enter:
    1. Name: GetStudentID
    2. Primary Table: choose Course Attendees
    3. Select Create Action

 Checkpoint

Configure the Lookup on the View Action 

  1. Hover over the  Calculate Action and select 
  2. 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
  3. Select the   View action on the canvas to open its  Properties
  4. In the Output Attributes section, click on the  icon 
    1. In the Available Attributes window, drag StudentID into the Output Attributes section of the  Properties
    2. Click OK
  5. Select the lu connector to map the incoming and outgoing data
  6. For the Incoming Mappings:
    1. Drag the CourseID attribute from the left (Calculate Action) into the Drag and Drop area on the right to create a corresponding attribute in the   View action
    2. Select Next
  7. For the Outgoing Mappings:
    1. Drag the StudentID attribute from the left (View Action) to the Drag and Drop area on the right to map a corresponding attribute back to the  Calculate action
    2. Right-click on the StudentID attribute you just created and select  Edit 
    3. Rename the attribute: StudentIDFound
    4. Click Confirm
  8. We need to filter the data coming out of the lookup 
  9. Click on the   View action to open its Properties
  10. In the Data Retrieval Options section, click the  icon next to Filter
    1. Name: ByCourseID
    2. Filter Details: 
      1. Click abc to tell PhixFlow to interpret the field as an expression
    3.  Apply and Close the Filter tab
  11.  Apply the View Action tab
 Checkpoint

Configure the Calculate Action and Output

  1. Click on the  Calculate action on the canvas to open its  Properties tab
  2. In the Output Attributes section, click the  icon to create a new attribute:
    1. Name: CourseStudentIDs
    2. Type: Choose Structured Data 
      1. This will return the results as an array
    3. Expression: 

      lu.StudentIDFound
    4. Click  Apply and Close

  3. Under Connections on the left, select  Add
  4. Add an Output Connection Point:
    1. Name: out
    2. Type: choose Output
    3. Click Create Connection Point
  5. Select Click to Connect and choose the CourseManagement  Form, then Connect Output
    1. Close the Mappings window that opens
  6. Hover your mouse over the  Calculate action on the canvas and click out
  7. When the red arrow shows, click on the  node under Connections
  8. On the Mappings window, drag across the CourseStudentIDs output attribute from the Calculate action into the Drag and Drop area on the right to create a corresponding attribute in the output
    1. Click Save
  9. Click the out connection point, under Connections
  10. On the Mappings window, drag the CourseStudentIDs output attribute from the output to the string field, StudentIDFromAttendees
    1. Click Save
  11. The Actionflow is now built
 Checkpoint

Setup Background Filter

The Actionflow will populate the string field, StudentIDFromAttendees, but the values in this field need to be linked to the Students contact cards using a background filter in order to only see the students for the selected course only.

  1. Return to the Course Management screen 
  2. Click on the Students contact card container to open the Card Component  Properties 

    1. Ensure you click on the white space underneath the top contact card to open the Card Component
  3. On the  Properties tab, in the Background Filter Rules section, click 

  4. Enter the Rule Expression: true
  5. Create a new filter by pressing  next to Filter:
    1. Name: ByStudentID
    2. Filter Details:  
    1. Click  Apply and Close on both the Filter and Filter Rule  Properties
  6.  Lock the screen and press the Enrolled Students button to see the Actionflow working

Once you have verified the Actionflow is working, the StudentIDFromAttendees string field can be hidden in the  Styles tab to tidy up the screen.


1.17 Instances and Reusability

  • No labels