There are 2 types of Lookup, Data Lookup and Element Lookup.
Data lookups are used to dynamically populate existing form elements with data.
Element lookups are user to dynamically generate form elements.
Create a Lookup
Lookup can be create by clicking "Lookup" on the left side menu, and clicking the plus button in the bottom right of the screen.
Choose the Lookup type either Data or Element and the source either Custom or Hosted (more on these below).
You will then need to give your Lookup and informative name and add the URL for the api endpoint.
Lookups can be configured across your environments, allowing for added versioning control across you apps.
For more on Environments check out this article.
How to Set up
Navigate to the form builder, in the element details there are the 'Enable Data Lookup', and 'Enable Element lookup' switches.
Once a switch is activated you can select from one of your configured Lookups.
Now the element will include a lookup button.
This will be disabled until the input contains a value.
The Data Lookup feature allows form elements to be populated form elements dynamically based on the values of specific elements.
For example, I want to type just the ABN of a business and have the rest of that businesses information automatically populate based on that specific ABN.
When the lookup button is clicked the form submission data is sent to the Lookup Source which dynamically populates the other configured form elements.
The Element Lookup feature allows the form to be populate dynamically with elements based on the value of specific element.
For Example, I want to do a stocktake of a warehouse. I have a list of items I want to check are in the warehouse, but the list of items is different for each warehouse.
When the lookup button is clicked the form submission data is sent to the Lookup Source which dynamically populates the form with the configured elements.
In doing this I can dynamically show the list of items based on the specific warehouse Id. Warehouse 123 has a very different list of items to warehouse 124.
Custom URL vs OneBlink Hosted
When creating a Lookup you can choose to use a Custom URL. When choosing a Custom URL you will be asked to provide the URL for the specific API endpoint you want the form data to be pushed.
Alternatively you can use our API Hosting service to create your own custom hosted APIs for your Lookups to point to. When selecting OneBlink Hosted, you will be asked to select an API and a route for each of your available Environments. For more on our API Hosting service check out out Github API CLI.
Lookups can be run automatically. If a lookup includes default or pre-populated data, the lookup will automatically run when the form initially loads. This can be used to populate forms immediately on load, or create entirely dynamic forms.
Customise Error Messages
You are also able to add your own unique error messages.
These are configured in the API.
Due to the lookup calling an external endpoint this functionality will only work while online.
Example Lookup API
For information on creating your own lookup API, check out our Server CLI examples.