Skip to main content

_LookupList

Last updated 4/12/2024

Overview

This documentation will demonstrate how to use Five's display type _LookupList. _LookupList 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.

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.

actionID.fieldID


Let's take a look at an example. In the Soul Food application, there is a form called Recipes that has three pages, General, Recipes, and Substitutes.

The Recipe Ingredients page has a field called Substitute Ingredient.

On the Substitutes page, substitutes for a recipe ingredient can be added. After adding the substitutes and returning to the Recipe Ingredients page, ideally it would be good to have all the substitutes listed in the Substitute Ingredient field without having to save the record first.


Without the _LookupList display type
Figure 1 - Without the _LookupList display type

If the display type _LookupList is used in the Substitute Ingredient field, the substitutes will be listed in the Substitute Ingredient's lookup.


With the _LookupList display type
Figure 2 - With the _LookupList display type

Back in Five, the Substitute table has been added which has a foreign relationship with the Recipe table and has a Name field.


Database model
Figure 3 - Database model

Form Setup

The Substitutes form has been added which references the data source Substitute table. This form has no menu item.


Substitutes form
Figure 4 - Substitutes form

The Recipe Ingredients form references the data source RecipeIngredient table. This form has no menu item.


Recipe Ingredients form
Figure 5 - Recipe Ingredients form

The Recipes form has three pages, General, Recipe Ingredients, and Substitutes.


Recipes form pages
Figure 6 - Recipes form pages

The Recipe Ingredients page is a list page that references the Recipe Ingredients form.


Recipe Ingredients page
Figure 7 - Recipe Ingredients page

The Substitutes page is a list page that references the Substitutes form.


Substitutes page
Figure 8 - Substitutes page

Add a _LookupList Display Type

The field we need to edit is the Substitute Ingredient field on the Recipe Ingredients form. In the lookup we want the values that are listed in the Substitutes list for the Name field.

1. Select the record in the list.

2. Click the Pages tab.


Pages tab
Figure 9 - Pages tab

3. Select the page record.


Page record
Figure 10 - Page record

4. Click the Fields tab.


Fields tab
Figure 11 - Fields tab

5. Select the field record (Substitute Ingredient field).


Field record
Figure 12 - Field record

6. Either click the Edit button in the form app bar or click directly in the Display Type field.


Edit button
Figure 13 - Edit button

7. Click the lookup icon in the Display Type field and select _LookupList.

info
The Page List Source field will show. In this field we need to add the action ID for the form and the field ID for the field that we want the values from in the format
actionID.fieldID
. So for this scenario it would need to be
Substitutes.Name

8. Type the action ID for the form and the field ID for the field in the format
actionID.fieldID
, example -
Substitutes.Name



Add a _LookupList display type
Figure 14 - Add a _LookupList display type

9. Click the Save button in the form app bar.


Save button
Figure 15 - Save button

10. Click the Save button in the form app bar above the list.


Save button
Figure 16 - Save button

_LookupList in the Form Wizard

If you know you want to use the display type _LookupList on creation of your form while using the Form Wizard, select _LookupList in the Display Type field. To add the page source list, you will need to edit the form record as documented above to add the action ID and field ID for the source.


Display Type field
Figure 17 - Display Type field