A quick walk through
Chong-ho (Alex) Yu, Ph.D., MCSE, CNE & Barnaby Wasson
The objective of this write-up is to show you how to create an online survey quickly. Advanced features will not be included in this write-up.
Creating a database
You can create a new file from scratch or adopt an existing template. Using a template is recommended if what you can find one that is similar to what you want to do. In this example, you will create a new empty file.
Since you will post the survey on the Web, you must create a new folder on the Web folder under the FMP folder, then place all files there. In this example, we name both the folder and the file 'survey.' Select Save from the file menu and type 'survey' in the Name field. Then click the New button to create a new folder. Enter 'survey' as the new folder name and click Create.
Now create some fields for this survey. In this example, you will create four fields: ID, Q1-Q3. Although ID appears to be a number field, ID numbers are nominal and thus you should leave the field as text. After creating all new fields, click Done.
As a general rule, it is better to impose some restrictions on the ID field: Making it unique so the same user will not submit the data twice and no two persons can use the same ID. Also, make it not empty so that users cannot skip this field and you will not get a record that is untraceable. In order to add these two field properties, double click the ID field on the Define Fields dialog box, select the Validation tab and check those options.
In this example, a five-point Likert scale will be used as the answer options for Q1-Q3. Define the Likert scale by selecting Define Value Lists from the File menu, then enter the value list name as 'likert' and the values: 1-5:
You must install the Web companion plug-in To enable web publishing. Choose Application Preference from the Edit menu and choose the Plug-in tab from the dialog box. Select Web companion:
Installing Web companion makes the FMP Web-ready in a global sense. Still, you have to enable the Web companion in individual files. Select Sharing from the File menu and check Web Companion. The survey is now Web-ready.
Putting data on the Web makes your file vulnerable to hackers. Thus, security must be tightened up. Open the database entitled Web security. It is located under Database inside the Web Security folder of the FMP folder. Add a new record, enter 'survey' as the database name. Then enter two new users: 'Admin' and 'All users'. Give the 'Admin' user a password but none to 'All users.' Assign all user permissions to 'Admin' but only 'create' to 'All users.' The Web Secuirty database must remain open all the time.
There are two types of security in FileMaker: FileMaker Pro Acccess Privileges and Web Security Database. For Web publishing, the latter is better. Since the default is the former, you have to change it manually. Go back to the Web Companion plug-in again by choosing Application Preference from the Edit menu. Click on Web companion to see its property. Then check the radio button Web Security Database.
Creating HTML files
The FileMaker part is basically finished. Leave the survey file open so it can be published on the Web. Now open a new file from HomePage. Choose FileMaker Connection Assistant.
Click Next on the next two dialog boxes to move forward. Click This computer in a dialog box as shown below to get the IP address of the computer you used to create the survey file. The IP address is blackout here because I don't want to invite any hacker. Click Connect to server to get a list of open database. In this example, there is only one database: survey.
Highlight survey by clicking on the file name, and press Next. Select Layout # 1 in the next dialog box.
Press Next to go to the next page, Feature Selection. In this example, we want to create a search page for the administrator to view the data and a new page to allow users enter data.
Press Next to go to Search Page. Add ID as your search field. Press Next again and you will see choices of logical operator. In this example, we accept the default by clicking Next.
At the Search Result page, add all fields to Search results fields. Click Next for the next dialog box to select a sort order. Choose No Sort Order for this example.
In the New Record page, add all fields. Leave the ID field as text but choose Radio Buttons for Q1-Q3. Enter 'likert' as the value list. Because the value list 'likert' has been defined in FileMaker, the same value options will be pulled from FileMaker rather than defined in the HTML page again and again. Not only does it save your time from typing, it also prevents hassle when you change the scale i.e. if you decides to use a 7-point Likert scale instead, you only need to update one place.
Click Finish to generate HTML files. Choose the survey folder as your save location. A few seconds later, Homepage shows you a readme file. Close it and you will see a list of HTML files. Although the HTML files have been created, the links are still broken. Click the Consolidate icon to establish links among all files and graphics within the folder.
Change graphics, wording, and layout if necessary. On some pages such as new.htm, you need to use the text editor to edit the page. To invoke the text editor, choose Edit HTML source from Window. Then type the statements to be rated with the Likert scale above the value list.
Transferring files to the server
Again, leave the survey database and Web Security database open. To test the survey, open your Web browser and enter 'http://localhost/survey' or “127.0.0.1” into the URL box. After everything is verified, do the following:
- Delete all dummy records for testing.
- Copy the entire folder to your server. This folder must also be located in the Web folder under FMP folder. You can do this by file sharing, FTP, or direct upload in HomePage.
- Open the survey database in the server.
- If the Web Security database is not open, open it now. Add the record "survey" into Web Security.
- If you use a Mac server, put an alias of survey in the Startup Items folder under the System folder. If you use a Windows server, put a shortcut of survey in C:\windows\program\Start Menu\Startup. Even if the server crashes and restarts, the database will be re-open automatically.
To export the data, in FileMaker Pro choose Export Records from the File menu. Save the file as a tab delimited file and Excel will read the data flawlessly.
There is an alterate way to import data into Excel. Since all fields are placed into search_results.html, you can simply save the html page as source. Excel will read the data seamlessly. For more info, please read the write-up Import data from a webpage table
FMP Tips Contents