How to query using controls

ABOUT

Along with querying data sources on form load or by using a button, you can also use Checkbox, Textbox, and/or Dropdown controls to trigger a query.  This is achieved by adding rules to query data on any of these controls if you have added a data source to your form.  You can add a NEW RULE to a control under Properties > Logic as shown below.

Note: Before attempting to query using these controls, you must add a SharePoint list Query Data Source to your form.  Please read this article for any guidance with setting up a query data source.

Dropdown controls are required for each example since they will be populated with the queried data.  There will be a rule on the control (checkbox, textbox, or dropdown), as well as a separate dropdown control with a condition to hold the filtered, queried values.  Important: To filter dropdowns, you must connect them to a Data source under Items in the properties of the dropdown as shown below.  

Below is the SharePoint contact list I will query.  I will specify columns, FirstName and  LastName, in my rules and filters.

1. Checkboxes

Checkboxes are the most simple to use since they only have 2 possible values, true (or 1) when checked, and false (or 0) when unchecked.  In a way, the checkbox is used similarly to a button, once it is selected, it can query a data source.

Example form in the form creator

HOW

The Checkbox will be set up to query when selected (true), and the rule on the Filter Dropdown will contain and filter the incoming data.

Query Checkbox

The rule on the Checkbox: If the checkbox is equal to true (selected), query the SharePoint list(QueryContacts). 

Filter Dropown

EDIT DATA SOURCE: Query FirstName if the LastName is equal to Smith. 

This means that when the query is triggered by the checkbox, this dropdown will populate with first names of people who have the last name, Smith.

2. Textboxes 

You can query a data source by entering a specific value into a Textbox.  In my example, I will type in last name, Smith, and first names that have the last name Smith in my SharePoint list will appear in the connected dropdown control.

Example form in the form creator

HOW

The rule on the Textbox: If the Textbox value is equal to Brown or Taylor (LastName), query contact list (QueryContacts).


Although the rule may look complex, it only means that if the Textbox value is equal to a specific last name, it will query the contact list.

Filter Dropown

EDIT DATA SOURCE: Show first names of contact if the last name in the Textbox is equal to Brown or Taylor. 

On my device, if I type Brown or Taylor into the Textbox, the corresponding first names will appear in the Dropdown.

3. Dropdowns

Instead of typing a last name as I did in the previous example, I will simply select a last name in my Dropdown to query FirstName from my data source.

Example form in the form creator

HOW

First, create a Custom list for the first Dropdown(dropdown1).  In my example, I'll enter last names Brown and Taylor as options to select within the Dropdown.  I want first names to appear if I select last name Brown or Taylor.

The rule on the Dropdown: If Dropdown value is equal to Brown or Taylor, query the FirstName of those with last name Brown or Taylor in my SharePoint list(QueryContacts).

The query is triggered when the Dropdown is equal to Brown or Taylor

Filter Dropdown

EDIT DATA SOURCE: When Brown or Taylor is selected in the first Dropdown(dropdown1), show first names of contacts with that last name in second Dropdown.  

On my device, first names will appear in my second Dropdown after selecting a last name in the first Dropdown.  I am simply filtering first names depending on the selected LastName.

 

 

 

 

 

 

 

 

 

 

 

 

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.