How-To: Filter Choices in a Dropdown Question

 

Scenario

An organization performs retail inspections and has a large existing customer base.  Their employees make site visits and fill out reports using ProntoForms, including filling out customer contact information.  Mobile workers already save time and reduce manual entry by selecting a company name from a dropdown list (which pulls a customer list from a data source); this leads to other questions being auto-populated with customer information.  However, mobile users often find it cumbersome to first scroll through a large list on their mobile devices to select a company name, particularly when many of the entries in the list are not applicable to them.

Solution: Question-Based Filtering

It is possible to configure mobile forms to dynamically filter data sources so that long lists of potential answers can be easily narrowed down to present users with a shorter list of applicable values, making ProntoForms even easier and faster to use. Listed below are two possible filtering configurations: filtering a list to only show items containing a user-entered search string, and filtering a list to only show items containing the user's username.

Both of these configurations are uses of Question-Based Filtering, which is the most powerful and flexible of the filtering options.  Read more about the other data source filtering options.  It is also possible to configure partitions on a data source to control what rows of the data source are available to users.  Partitions are configured at the data source level, rather than the form level, which means that the filtering occurs across all forms referencing the data source.   

The Source Data

The spreadsheet below is a sample of source data for customer information.  The "Rep" column contains the ProntoForms username of the mobile user who is representative for the customer account.  Note that some customers have two contact people in their organization, and therefore have two rows of contact information.

Upload the source data through any data source of your choosing.

sourcedata.png

 [ top ]

 

Filter a List Based on a Search String

Using the data source above, we will configure the filter so that the user can enter part of a company name into a textbox, and have the list narrowed to only names containing the entered value; for example, if they type "ABC" into the search box, the dropdown list will only show company names containing "ABC." Note that the filter can only search for this string in one, pre-configured column of the data source.

Configure the Form

All configuration takes place in the form builder.  Only two questions are required to create a filtered list.  The dropdown list can still be used to auto-populate other questions afterwards; read more about configuring a dropdown/radiobutton question to auto-populate other fields.  

Question 1: The "Search" Box

Create a simple textbox that users can manually enter a value into.  

Data Type: Text
Control Type: Textbox
Question Text: Search Company
Question Label: Search Company
Hidden on Reports: True

 

Question 2: The Dropdown List

Data Type: Text
Control Type: Dropdown
Question Text: Company
Question Label: Company

After configuring these basic properties:

  1. Mouse over the question and enter the "Edit Properties" screen.
  2. Enter the "Dropdown Properties" tab.
  3. For Data Source, select "Data Source."
  4. Choose the name of the data source.
  5. Select "Company Name" (the column in your data source) as the Display Column.
  6. Select the Apply Filtering box.
  7. Choose Question-Based as the filter source.
  8. Select "Company Name" as the filtered column.
  9. As the Filter Source (Question), select "Search Company" (the preceding textbox).
  10. Save your changes to the question, and save the form (Draft or Finish, depending on your testing configuration).

Testing the Configuration

It is important to test the functionality of any new forms/changes to forms before deploying to production use.  Try entering a string that can be found in some of your data source rows to ensure the filter works correctly.  

[ top ]

 

Filter a List Based on the User's Username

Instead of filtering the above data source based on a manually entered search string, it may be more useful to have the list automatically filtered to show the user only a list of companies that they are a "Rep" for.  This can be setup similarly to the configuration above, but without requiring the user to manually enter a search term; the "search" box can be auto-populated with their username.

Configure the Form

All configuration takes place in the form builder.  Only two questions are required to create a filtered list.  The dropdown list can still be used to auto-populate other questions afterwards; read more about configuring a dropdown/radiobutton question to auto-populate other fields.  

Question 1: The "Search" Box

Create a simple textbox that users can manually enter a value into.  

Data Type: Text
Control Type: Textbox
Question Text: Username
Question Label: Username
Read-Only: True
Hidden on Reports: True

With these basic options configured:

  1. Mouse over the question and enter "Edit Properties."
  2. Enter the "Textbox Properties" tab.
  3. Select "Insert User's Username as Default Value"

 

Question 2: The Dropdown List

Data Type: Text
Control Type: Dropdown
Question Text: Company
Question Label: Company

After configuring these basic properties:

  1. Mouse over the question and enter the "Edit Properties" screen.
  2. Enter the "Dropdown Properties" tab.
  3. For Data Source, select "Data Source."
  4. Choose the name of the data source.
  5. Select "Company Name" (the column in your data source) as the Display Column.
  6. Select the Apply Filtering box.
  7. Choose Question-Based as the filter source.
  8. Select "Rep" as the filtered column. Note: The values in the "rep" column must exactly match the ProntoForms username, not their display name or any other identifier.
  9. As the Filter Source (Question), select "username" (the preceding textbox).
  10. Save your changes to the question, and save the form  (Draft or Finish, depending on your testing configuration).

Testing the Configuration

It is important to test the functionality of any new forms/changes to forms before deploying to production use.  If this configuration doens't work, it's likely that the usernames in your data source are incorrect.  

 [ top ]

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments