The
University of Texas at Austin
Skip to page content.
Information Technology Services
|
|
|
||
About ITS ITS Services Contact ITS ITS Departments ITS Employment ITS News ITS Help Desk
|
|
|
|

| | | | |
|
| header |
|

Data Collection

|
|

Introduction

Advantages of Online Surveys

Disadvantages of Online Surveys

Designing the Questionnaire

Creating the Questionnaire

Data Collection

Data Analysis

Getting Good Data

Ethical Issues and "Netiquette"

Putting it all Together

References

|

This tutorial discusses three common methods of data collection:

  1. send the information to yourself via e-mail,
  2. send the information to a tab-delimited file, and
  3. send the information to a database.

These actions take place upon the respondent clicking the Submit button. The first two methods involve the use of a CGI script. When the Submit button is clicked, a script is called determining what happens to the data gathered from the form. For information on CGIs, look at TeamWeb's CGI Scripts page.

  • To receive form results in e-mail, see Comments Forms. This method is relatively quick and easy to use and convenient if your sample size is small. The information from the form will have to be transferred from the e-mail message to another application for data analysis.

  • To save form data in a tab-delimited file, see Save Form in the CGI Tutorial. This method is also relatively quick and easy to use. The file can be easily imported into Microsoft Excel, SAS, or SPSS for analysis.

  • The third method of data collection involves the use of a database and the scripting language called ColdFusion. ColdFusion is a Web development tool which is used to create databases and then access the information in the database and dynamically create Web pages. Microsoft Access is the database of choice and ColdFusion the scripting language of choice because of their accessibility and stability at UT Austin and because of the relatively low learning curve. If you want to require any or all of your questions to be answered, ColdFusion is the method to use. Microsoft Access databases can be imported into SAS for analysis. For information on how to get started using ColdFusion at UT see ITS' Adobe Coldfusion.

Basic ColdFusion Commands or Tags

A ColdFusion application is a collection of HTML tags and special ColdFusion tags (they all begin with CF) that instruct the ColdFusion server to perform specific operations. ColdFusion tags, variables and functions are used with HTML to create dynamic, data-driven Web pages.

<CFINSERT> adds a single row to a database. This tag requires that the database and table name be included. For example, <cfinsert datasource="ODBC Data Source" tablename="table name">.

Sample <CFINSERT> Attributes
datasource (required) Name of ODBC Data Source
formfields (optional) List of fields to insert if data are present
password (optional) Database password
username (optional) Database login name
tablename (requiredl) Name of table to insert data into

While <CFINSERT> is easy to use, it also removes all control over how you handle your queries. It is preferable to use a <CFQUERY> tag with SQL commands as found in Putting It All Together. Look here for an example of a complete script.

<CFQUERY>, </CFQUERY> queries a database for specific information. The use of the 'name' attribute is strongly suggested. The results of the query will be called "name". For example, <cfquery name="x" datasource="ODBC Data Source"> .....</cfquery>.

Sample <CFQUERY> Attributes
datasource (required) ODBC data source
name (required) Query name
password (optional) Database password
username (optional) Database login name

(See Putting It All Together for an example of a complete script.)

<CFOUTPUT>, </CFOUTPUT> displays the results from from the query. If <cfquery> is used, any code between <cfoutput> and </cfoutput> is repeated once for every row in the database. For example, <cfoutput>Employee <b>#name#</b> added. </cfoutput>.

<CFOUTPUT> Attributes
group (optional) Column in database to group on
maxrows (optional) Maximum number of rows to display
query (optional) Query name
startrow (optional) First row to display

(See Putting It All Together for an example of a complete script.)

Security and ColdFusion

To make your database more secure, set a database password in Microsoft Access. To do this, after receiving your datasource name, go into Microsoft Access, choose Tools/Security/Set Database Password and set a password for the database. By default, the username will be 'Admin'. Then, using an application.cfm script, you can set the username and password as Cold Fusion application variables. (See #1 below.) Store this file in the directory where your Cold Fusion scripts are and use application.cfm everytime you do a <cfquery>. (See #2 below.)

  1. Create a file called application.cfm that looks like this:

    <cfapplication name="security"
            clientmanagement="Yes"
            sessionmanagement="Yes"
            setclientcookies="Yes"
            sessiontimeout="#CreateTimeSpan(0,0,60,0)#"
            applicationtimeout="#CreateTimeSpan(0,0,60,0)#">

    <!--- Set application constants --->

    <cfset application.mydatasource_username="Admin">
    <cfset application.mydatasource_password="whatever">

  2. Put this file in the directory where your ColdFusion scripts are. Then every time you do a <cfquery> it will look like this:

    <cfquery name="myquery" datasource="mydatasource" username="#application.mydatasource_username#" password="#application.mydatasource_password#">

    SQL blah blah

    </cfquery>

In the ColdFusion environment, every time a script executes, the first thing that happens is the ColdFusion engine searches the page's directory for a file called application.cfm. If found, it gets processed ahead of the script. If not found, ColdFusion searches up the directory tree and will use the first application.cfm page it finds. The ColdFusion engine will never let the outside world see the contents of that file. Most of the attributes in the application file are optional and are used for ColdFusion client and session management.

Basic content of an application.cfm file are the scope variables client, session, and cookie and how long they are active.

<CFAPPLICATION> Attributes
name (required) Name of application
clientmanagement (optional) Enable or disable client variables
sessionmanagement (optional) Enable or disable session variables
setclientcookies (optional) Enable or disable client cookies
sessiontimeout (optional) The time span for the persistence of session scope variables. Uses CreateTimeSpan.
applicationtimeout (optional) The time span for the persistence of application scope variables. Uses CreateTimeSpan.

(For assistance with using CGI or ColdFusion scripts, contact TeamWeb's consulting desk. For assistance with creating a Windows account, ColdFusion Registration and DSN requests, call 475-9400 to make an appointment with the Windows Services Group.

Top

|

Information Technology Services. Infrastructure. Innovation. Integrity.

Last updated January 29, 2008.
Copyright © 2001-14, Information Technology Services at The University of Texas at Austin.
All rights reserved. For privacy concerns read our privacy policy.

To submit questions or comments regarding this page, use the online Comment Form.