Using a Lookup allows you to create a mapping between two Apps to pull information back from data stored in a lookup App and use it in the Main App. In this article, we will demonstrate this capability by showing how to create a database for Companies (Lookup App) and use this to populate the Company information in a Risk (Main App).
Create a Resource App
source for the data that will populate the data in your Main App. It will need to contain a Field for each piece of information that you need to populate. For our example, we have created a Companies App that contains the Name, Location, Industry Sector, Contact and Contact No.
By Adding Records to this Company lookup App, each Record then becomes a Company that can be selected when using the LookUp Field to populate the Company information in the Risk.
Create Fields in your Main App
For every Field value in the Resource App that you would like to be populated in the Main App via the LookUp, you will need an equivalent Field in the Main App. The Field should be a match for Field Type as well to ensure that data keeps it's. Here we have created Fields in our Risks App as a destination for the values that are being mapped from the Company lookup App.
Here, we have added them to their own template called Company.
Create a LookUp Field to Pull In the Data
Now that we have a lookup App that is the source for the data and similar Fields in our Main App, we can create the mappings to use the data in our lookup App to populate Fields in the Main App.
In your Main App, add a new field and select the Field Type as 'LookUp'. The label for the Field is the instruction for Users to use this Field to perform the LookUp of data.
This will then ask for two pieces of data. The first is the 'LookUp Name' which is the name of the App that you are looking up the data from. In our example, this is the Company LookUp. The Field also requires a 'LookUp Search Field'. This is a Field from the App that if a user starts to type in the LookUp Field before selecting the magnifying glass to perform the search, will filter down the results in the LookUp pane to only show those that contain the typed text in the selected Resource App Field.
Note: You can create a Field in the Resource App that concatenates the text of multiple Fields making more than one Field the Lookup Search Field. Here we could add a Field in the Resources App called Name & Location with expression [CompanyName] + '-' + [CompanyLocation]. If we selected this as the LookUp Search Field then it would perform a search on Name or Location.
Then you will need to determine the mappings for the data. Each piece of information passed from the Resource App to the Main App is a single mapping.
To add a new Mapping first click on 'Add Item'. You will then need to define three things for each mapping:
Identifier: This is the unique reference to the mapping within the set of Field Mappings for the Lookup.
Parent Field: The Parent Field is the Field from thee Resource App that contains the value you would like to move across to the Main App.
Child Field: The Child Field is the Field in the Main App that the value from the Resource App should be mapped to.
Once you are happy with the Field Mappings, save the LookUp Field and add it to a template near the Fields that you are using the LookUp to populate data for.
To see more on how too use a lookup expression, please click here