Creating a Data Set Using a SQL Query

How to create a data set using a SQL query

A data set can be created to "pull" data from a SQL Server database. To retrieve this information, a SQL Server data connection needs to be set up. This procedure outlines the basic steps for creating a SQL Query data set. For more detailed information about data sets, see Creating a Data Set.

For example, let's use an Onboarding New Employees form that newly hired employees must complete. You want to include contact information for the Human Resources team on the form in case employees need assistance while filling it out. To achieve this, you can create a data set of employees from the Human Resources Department, along with their phone extension numbers. This information is stored in a table within the SQL Server database:

Now let's add this information to a data set:

  1. From the Reusable Components menu, select Data Sets. Click New Data Set. The Data Set Designer opens.
  2. In the Data Set Name field, enter a name for the data set. In this example, we'll name the data set Human Resources-Employees.
  3. From the Data Connection field, select the data connection from which the data is to be retrieved. In this example, we are using the eLearning data connection, which is a SQL Server connection type.
  4. From the Data Origination field, select SQL Query because that is where the data comes from. 
  5. Enter the SQL query to retrieve the data fields. In this example, we'll use Select * from HREmployees.
  6. Click Generate Data Fields to run the query and display a subset of the data.
  7. Click (Save) to save the data set.
  8. The data set can now be applied to the Onboarding New Employees form.
  9. After the data set is applied, preview the form to see how this information is displayed: