_LookupList
Last updated 25/11/2024
Introduction
This documentation will demonstrate how to use Five's _LookupList display type.
The _LookupList display type enables you to set a field in a list on the current form to use its values as the lookup values in a field. The values will dynamically update in the field's lookup without having to save the form first, as the data will be retrieved from the frontend in combination with the data saved in the backend.
How to Use the _LookupList Display Type
The _LookupList display type requires you to make the selection of _LookupList in the Display Type field. When you select _LookupList a new field will become available called Page Source List. This will require you to add the field on the current form that will be used to get the values for the field's lookup. For Five to know where the source is, you will need to specify the action ID for the form and the field ID for the field like the example code below.
Before you begin this documentation, please refer to the Introduction to Five's Lookups chapter so you have an understanding of the database design to demonstrate the display type _LookupList. All the tables used to demonstrate Five's lookups are documented in the Introduction to Five's Lookups chapter so you can build them if you wish and use them to learn about our lookup display types.
This documentation is designed for you to build and add data to get an indepth understanding of all of Five's lookup display types.
Add a _LookupList Display Type
The forms created below will be used to dynamically retrieve the Name values from the Substitutes list to populate the Subtitute Ingredient field's lookup on the Recipes form using the display type _LookupList. This will enable you to assign a substitute to a recipe ingredient.
Prerequisite
- The list you want to retrieve the data from must be on the current form.
Steps
1. Click the New Form Wizard button.
2. Click the lookup icon in the Main Table field and select Substitute.
3. Click the Add Menu Item switch.
4. Click the Next button.
5. Click the List checkbox for the Name field.
6. Click the Save button in the Form Wizard app bar.
7. Select the Recipes record in the list.
8. Click the Pages tab.
9. Click the Add Pages button.
10. Type Substitutes in the Caption field.
11. Click the lookup icon in the Page Type field and select List.
12. Click the lookup icon in the Action field and select Substitutes (Form).
13. Click the Save button in the form app bar.
14. Click the Save button in the form app bar above the list.
In the Soul Food application, the Recipes form now has two list pages: Recipe Ingredients and Substitutes. Currently, if a substitute is added, the substitute would not dynamically populate in the Substitute Ingredient field on the Recipes Ingredients form as it is a text field and the data is not saved in the backend yet. You can see this in the image below.
The Recipe Ingredients form will be edited to have a _LookupList display type in the Substitute Ingredient field. This will make the substitutes entered to be available on the Recipe Ingredients form before saving the Recipe form.
15. Select the Recipe Ingredients record in the list.
16. Click the Pages tab.
17. Select the General record.
18. Click the Fields tab.
19. Select the Substitute Ingredient record.
20. Either click the Edit button in the form app bar, or click directly in the Display Type field.
21. Click the lookup icon in the Display Type field and select _LookupList.
22. Type Substitutes.Name in the Page List Source field.
23. Click the Save button in the form app bar.
24. Click the Save button in the form app bar above the list.
Recipe Form in the Soul Food Application
1. Click the Run button in the toolbar.2. Click Recipes in the menu.
3. Select the Lemon Chicken record in the list.
4. Click the Substitutes tab.
5. Click the Add Substitutes button.
6. Type Legs in the Name field.
7. Click the Save button in the form app bar.
8. Click the Recipe Ingredients tab.
9. Select the Thighs record.
10. Either click the Edit button in the form app bar, or click directly in the Substitute Ingredient field.
11. Click the lookup icon in the Substitute Ingredient field and select Legs.
12. Click the Save button in the form app bar.
13. Click the Save button above the list.