Often times it can be useful to filter lists of data based on other data elements. This is commonplace in various accounting and human resources scenarios, but the most understandable example to all users might be a vehicle lists. In this scenario, two lists are used. The first represents the makes (or brands) of vehicles. The second list should dynamically populate based on the user's selection in the first list. The resulting data grid might look like this:
When a new row is added, the user is asked to choose the Vehicle's make:
The Model list will then dynamically present based on the Make selection for that row.
With "Aston Martin" selected:
With "Rolls Royce" selected:
Database Setup
To implement this example, a database will be required containing the vehicle information. A simple table with a Make and Model column is all that is required:
Using the table setup described here, additional Routes can be added to the GlobalForms configuration to expose the data to any forms that might need it. Refer here for more information on setup of Routes for GlobalForms. Note that any changes will require a restart of the GlobalForms server service.
{ "method": "get", "endpoint": "/makes", "query": "SELECT distinct make FROM [Vehicles];" }, { "method": "get", "endpoint": "/makes/:make", "query": "SELECT model FROM [Vehicles] where make = '{{ params.make }}';" }