A DataSource in GoFormz is like a simplified database table. DataSources can be referenced by form fields to provide a powerful way to simplify data capture and increase accuracy.
There are two primary use cases for DataSources in GoFormz:
- Auto-populating form fields. GoFormz can use a DataSource to auto-populate fields in a form based on the value of another field. For example, your form might have fields for customer name, address, and phone number. You may want the address and phone number to fill automatically when a user selects the customer name. You can do this with a DataSource.
- Option filtering. GoFormz can use a DataSource to present options to a user based on the value of another field. For example, your form might have fields for the make and model of a car. Then you will likely want the model options presented to the user to depend on the make that they selected — so if they select Ford they only see Ford models, if they select Toyota they only see Toyota models, etc. You can set up this kind of logic using a DataSource.
DataSource structure is simple. Each DataSource is a table, where the rows are called records. The records typically represent some object or entity (e.g. a customer), and the columns provide information about that entity (e.g. customer name, address, phone number).
There are two important concepts to understand when dealing with DataSources — key columns and indexing.
Each DataSource must have a key column, and the key column must be unique — i.e. no two records can have the same key column value. This requirement is necessary for the first use case described above — auto-populating form fields.
Let’s go back to our first example — a DataSource containing columns for customer name, phone number, and address. In this example, customer name is our key column, because that’s the column that we want to use to auto-populate the phone number and address. But in order to do this, there can only be a single record for each customer name. If the same customer name is found in multiple records, then GoFormz would have no way of knowing which record’s address and phone number should be used!
Indexing a DataSource on a particular column lets you use that column for data retrieval. The Key column is always indexed, and you can index up to 5 additional columns per DataSource. In practical terms, this enables the second use case described above — option filtering.
Let’s go back to our second example — a DataSource containing columns for car makes and models. The goal is to use these columns in a form in the following way:
- A “Car Make” form field that displays all unique makes from the DataSource as options for the user.
- A “Car Model” form field that displays the appropriate models from the DataSource based on the make selected by the user.
Indexing the DataSource on both the make and model columns enables this.
Use the links below for more information on: