Using a LookUp allows you to create a mapping between two Apps to pull information back from data stored in a Resource App and use it in a Main App. In this article we will demonstrate this capability by showing how to create a database for Companies (Resource App) and use this to populate the Company information in a Proposition (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 Resource App, each Record then becomes a Company that can be selected when using the LookUp Field to populate the Company information in the Proposition.
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 Proposition App as a destination for the values that are being mapped from the Company Resource App.
Here, we have added them to their own template called Company Information.
Create a LookUp Field to Pull In the Data
Now that we have a Resource 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 Resource 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 Resource 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 Resource 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.
Tip: 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.
Performing the LookUp via Expression
As an alternative to using a LookUp Field, the method to populate the Field values in the Main App can be added by Expressions. The mappings will then be performed for a Record each time the Record is updated in the Main App.
For each Field that you would like to have the value populated via a LookUp, add an expression in the format
AppID is the ID of the Resource App being used to store the LookUp data
ThisAppFieldID is the ID of the Field in the Main App that the value in can be compared to a Field in the Resource App to determine the correct Resource Record to return data from.
LOOKUPAppFieldID is the Field ID in the Resource App that the value in the ThisAppFieldID will be compared against to find the correct Record to return data from
LOOKUPAppFieldToReturn is the Field in the Resource App that contains the value that will be returned on a successful find of a Record
ValueIfNotFound is the value the Field is to be set to if no Records in the Lookup App are a match
ExactMatch? is a boolean property. If true then the values in the compared Fields must be an exact match and if false then the first record in the Resource App with a value for the compared Fields that contains the value from the Main App will be a match