pamela.denchfield

Retrieve cities from a database

Blog Post created by pamela.denchfield Employee on Oct 26, 2015

Nintex Forms Enterprise Edition

 

This tutorial walks through steps to retrieve country and city data from a SQL Server database and filter the returned city data based on the selected country.

Figure: Example of a form listing cities for the selected country; if another country is selected, the list of cities is updated.

 

Prerequisites:

  • Database table "Cities" containing two columns: Country and City
    Example:
  • Secure Store target application ID for credentials to the SQL Server database
    For more information on Secure Store, see the Microsoft article Configure the Secure Store Service in SharePoint 2013.
  • List columns for binding the value and display fields for each instance of the SQL Request control (optional)

 

Steps:

  1. Add the SQL Request form control for "Country" and apply the following configuration.
    FieldValueNotes
    NameCountry
    Display formatDrop down list
    Query typeSQL
    Query

    SELECT [Country]

    FROM [CrestanDemoData].[dbo].[Countries]


  2. Add the SQL Request form control for "City" and apply the following configuration.
    Note: Red text indicates inserted references.
    FieldValueNotes
    NameCity
    Display formatDrop down list
    Query typeSQL
    Query

    SELECT [City]

    FROM [CrestanDemoData].dbo].[Cities]

    WHERE Country='Country'

    To insert a reference to the "Country" control, select it from Named Controls in the Insert Reference dialog box.
  3. Publish the form and you're done!

Outcomes