<< Click to Display Table of Contents >> Navigation: Collect > Collect Enterprise > Template Designer Page > Forms and Fields > Field Types and Attributes > Collect Forms – Form Lookup Field Type |
The "Form Lookup" field type is designed to pull or filter data/information from other forms within the same template and provide that data/information to the user on the mobile device in a dynamic drop-down selection list.
When the Form Lookup field type is assigned to a field, the Multiselect check box is available on the Edit Field window. Checking the Multiselect box allows users to select multiple records from another form on the mobile device. The Multiselect default value is unchecked.
Notes: •To use the Form Lookup field type, form(s) must already be saved in the template. •Selected options in a Form Lookup can be deselected by clicking the selected option(s) again. |
---|
A project manager wishes to have Collect users select a location code from a list of sampling locations that are appropriate for a planned sampling event. The Collect template will use Pre-Population to include location data in a "Locations" form when sent out to the Collect Mobile app. A "Sampling" form will have a field where the user will select the location code from the data pre-populated into the "Locations" form record. Furthermore, the template could filter down the list of location records based on location type.
The template illustrated below is an example where the LowFlowSample form has a WellID field, which is a form lookup field type, that references the Locations sub-form on the SPM_REF form.
1.In a Template designed for sampling, create and setup a Locations form. This form will be populated with location data from EQuIS.
2.Add as many fields as desired to be pre-populated. Note which field is selected to be the form's Header (e.g., SYS_LOC_CODE).
3.Setup Pre-population on the form template with a user report that has the desired location data.
Note: Form Lookup fields can only be pre-populated with ID values, which are auto generated integer values that match the form selected by the user, making Form Lookup fields incompatible with pre-populated string or decimal values. |
---|
4.On another form (e.g., sampling form), add a field (e.g., WellID) that will be a lookup list to these pre-populated locations.
5.Set the Field Type to Form Lookup.
6.Click Form Name and choose the Locations form from Step 1 as the target for a drop-down list. (Note that the Form Name property is required and cannot be left blank).
7.Click OK.
The following image is an example of how the drop-down list will display in the Collect Mobile app as a list of the Headers on those forms (e.g., SYS_LOC_CODE).
If desired, change the FormValue attribute to use a different field from the target form to serve as the text on the items in the selection list.
If desired, use the FormFilter attribute to control which of the target form's records should be displayed in the selection list. The formula set in the FormFilter attribute should use aggregate fields belonging to the target form and ultimately return TRUE or FALSE. For example, to show only location records that are of a "Monitoring Well" location type, use this formula in FormFilter:
EQ([Locations.Location_v1:Loc_Type],'MONITORING WELL'), or
EQ([Locations.Location_v1:Loc_Type],[Well_Type])
Form lookup fields ultimately store a Form ID (an autogenerated integer that is generally hidden) that matches the form chosen by the user. In the above example, the form lookup field will let the mobile user select the field and see a selection list of SYS_LOC_CODES. The user selects a SYS_LOC_CODE and the chosen SYS_LOC_CODE will appear in the app, but the data stored behind the scenes on this field will be an integer Form ID. To ensure that the SYS_LOC_CODE is sent back to EQuIS instead of a Form ID, set the field's data mapping as follows:
1.Edit the field form that contains the field that looks up to the "Location" form.
2.Click Data Mapping.
3.Setup a mapping to the format section's SYS_LOC_CODE field.
4.Click Value to set the logic for the value that should be stored.
5.Add a formula like the following:
GET(EQ([Location.#id],[WellID]),[Location.sys_loc_code])
This formula uses the Form ID number stored in the field to find the linked "Locations" form, then obtains the SYS_LOC_CODE value on that same form.
6.Save changes.
Copyright © 2023 EarthSoft, Inc • Modified: 01 Feb 2023