Insert excerpt | ||||||||
---|---|---|---|---|---|---|---|---|
|
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. 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 students attending that course
- Write those Student ID(s) back to the screen onto a field
- Setup a background filter that only show students in a Students grid that match the Student ID in the field
Create Calculate Action and View Action
- Add a button to the Tile - Footer area beneath the school courses grid
- Name: Enrolled Students
- Right-click on the button and choose
Insert excerpt _actionflow_add _actionflow_add nopanel true - Enter a name for the Actionflow,
- Name:
Find Students
- Select Confirm
- Name:
- Select Click to Connect and for the input, choose the School Course
data source, then select Connect InputInsert excerpt _grid _grid nopanel true - In the Mappings window that opens, drag the CourseID attribute from the left to the right
- Select Save
- Click and drag the
icon from the toolbar onto the canvasInsert excerpt _action_calculate _action_calculate nopanel true - In the Create Calculate Action window enter:
- Name:
FindStudents
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 without being processed.
- 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_calculate _action_calculate nopanel true - Right-click on the in connector and choose
Insert excerpt _open_mappings _open_mappings nopanel true - Drag the CourseID attribute on the left onto the Drag and Drop area on the right
- Select Save
- To lookup to the Course Attendees table, we need to create a View Action
- Click and drag the
icon from the toolbar onto the canvasInsert excerpt _action_view _action_view nopanel true - In the Create View Action window enter:
- Name:
GetStudentID
- Primary Table: choose the Course Attendees data
Select Create Action
- Name:
Expand | ||
---|---|---|
| ||
Configure the Lookup on the View Action
- Hover over the calculate action and select
- Enter a name for the lookup connector:
- Name: lu
- Select Confirm
- 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
iconInsert excerpt _attributes_icon _attributes_icon nopanel true - In the Available Attributes window, drag StudentID into the Output Attributes section of the properties
- Click OK
- Select the lu connector to map the incoming and outgoing data
- For the Incoming Mappings:
- 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
- Select Next
- For the Outgoing Mappings:
- Drag the StudentID attribute from the left (View Action) to the Drag and Drop area on the right to create a corresponding attribute back to the Calculate Action
- Right-click on the StudentID attribute you just created and rename it
- Click Confirm
- We need to filter the data coming out of the lookup
- Click on the View Action to open its properties
- In the Data Retrieval Options section, click the
icon next to FilterInsert excerpt _addIcon _addIcon nopanel true - Name: ByCourseID
- Filter Details:
the Filter tabInsert excerpt _finish _finish nopanel true
the View Action tabInsert excerpt _save _save nopanel true
Expand | ||
---|---|---|
| ||
Configure the Calculate Action and Output
- Click on the Calculate Action on the canvas to open its properties
- In the Output Attributes section, click the
icon to create a new attribute:Insert excerpt _addIcon _addIcon nopanel true - Name: CourseStudentIDs
- Type: Structured Data
- This will return the results as an array
Expression:
Code Block language java lu.StudentIDFound
Click
Insert excerpt _finish _finish nopanel true
- Under Connections, select
AddInsert excerpt _addIcon _addIcon nopanel true - Add an output connection point. name: out
- Click Create Connection Point
- Select Click to Connect and choose the
datasource, then Connect OutputInsert excerpt _form _form nopanel true - Close the mappings window that opens
- Hover your mouse over the Calculate Action on the canvas and click out
- When the red arrow shows, click on the output node
Insert excerpt _output _output name icon nopanel true - On the Mappings window, drag across the CourseStudentIDs output attribute from the Calculate Action Action into the Drag and Drop area on the right to create a corresponding attribute in the output
- Click Save
- Click the out connection point, under Connections
- On the Mappings window, drag the CourseStudentIDs output attribute from the output to the string field on the screen, StudentIDFromAttendees
- Click Save
- The Actionflow is now built
Setup Background Filter
The Actionflow will populate the string field, StudentIDFromAttendees, but 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.
- Return to the screen containing the school courses grid
Right-click on the Students grid and choose
Insert excerpt _view_show_config _view_show_config nopanel true - In the Data Retrieval Options, next to Background Filter, click
Insert excerpt _addIcon _addIcon nopanel true - Name: ByStudentID
- Filter Details: