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.
Note: To use the Form Lookup field type, form(s) must already be saved in the template.
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.
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).
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
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:
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.
Copyright © 2021 EarthSoft, Inc • Modified: 11 Aug 2021