2009-08-03
QPL Reference Manual

A QPL web questionnaire is created by first creating a QPL program as an ASCII text file and then writing commands using the QPL programming language syntax to define indvidual questions and other attributes of your project such as the project title and home page information. The QPL compiler reads this file and uses it to build your web site files.

The QPL language has over 100 commands that you can use to create your questionnaire web site project. There are global commands that you only use once, such as the TITLE command to name your project or the HELLO command to enter content on your project's home page. There are commands that you will use many times, such as using the QUESTION command to build one question. And there commands that you can use apply the same settings across a group of questions, such as using the MATRIX command to put a group of questions into one matrix (i.e., horizontal) layout. Your QPL program file will contain all the commands needed to define your entire project, from the web site home page to all of the pages of the questionnaire.

sample.pg6 Questionnaire Program

*! ********************************************
   PROGRAM: sample.pg6 
      DATE: 2009-08-06
    AUTHOR: KEVIN DOOLEY

     TITLE: SAMPLE QPL QUESTIONNAIRE
*! ********************************************

* Global commands...

.TITLE = "Sample QPL Questionnaire"
.COLORSCHEME = #7b9b5a
.MENU = OFF

* Home page...

.HELLO = ON
Welcome to my questionnaire.
.HELLO = OFF

* Questions...

.QUESTION = NAME, TYPE = STRING
What is your name?
.ANSWER = 15
.NEXT

.QUESTION = AGE, TYPE = NUMBER = "### years"
How old are you [NAME]?
.ANSWER
.NEXT

.QUESTION = GRAD, TYPE = LDATE
When did you graduate from high school?
.ANSWER
19660601
.NEXT

.QUESTION = SEX, TYPE = MULT
What is your sex?
.ANSWER
Male
Female
.NEXT

.QUESTION = COMMENTS, TYPE = OPENEND
What are your hobbies?
.ANSWER
.NEXT

This short questionnaire contains five questions. View the home page that the QPL compiler creates from this program and then click on the "Begin questionnaire" button on the home page to open the questionnaire form that it also created.

The QPL compiler also always creates a log file that lists any errors or warnings it found when processing your program file. This is a text file that has the same name as your program, but the file name extension is changed to ".err."

sample.err Error Log File

Error Log File
C:\dooley\qpl6ref\sample\sample.qpl
Wed Aug 12 08:26:46 2009

-->  C:\dooley\qpl6ref\sample\sample.pg6
1: *! ********************************************
*** WARNING - Block comment is ON.
              The following program lines will be ignored.

7: *! ********************************************
*** WARNING - Block comment is OFF.

<--  C:\dooley\qpl6ref\sample\sample.pg6

   Questions: 5
 Record size: 37 bytes
      Errors:    0
    Warnings:    2

Program Lines

Each line in your can have one of several different purposes. One line may contain

The QPL compiler expects every line of your program to end with carriage return and line feed codes. This means that you should not depend on how your word processor automatically wraps lines according to your margin settings, but instead make sure that you have pressed Enter to end each line. One line may not be more than 500 characters long.

The compiler expects your program lines to contain only standard ASCII characters, and not any codes that are unique to your word processor. To avoid possible problems, we recommend using an ASCII or HTML text editing software to write your QPL program, such as Windows Notepad or Adobe HomeSite (or other product) and not a word processor like Microsoft Word.

Command Lines

All command lines in a questionnaire must begin with a period in the first column of the line. QPL commands must be used to define a question's variable name and type, and where the question and answer text begin and end. More than one command may be typed on a line if the commands are separated by a comma or a blank space. Command words may be written in either uppercase or lowercase letters.

.TITLE = "Sample QPL Questionnaire"

This example shows a command line where the TITLE command was used to set the title of the project to "Sample QPL Questionnaire."

Comment Lines

You may include notes or documentation about your project in your program file by putting them in comment lines. These lines are ignored by the QPL compiler when it reads your program.

Comments may be included in your questionnaire program by typing an asterisk in the first column of a line. The entire line, up to the carriage return, is ignored when the QPL compiler when it reads your program and builds your web site files. Comments can also be added to the end of command lines by typing an asterisk, and then the comment.

* This is a comment line.

.NEXT = variable name * This is a comment on a command line.

You may also mark a series of lines as a comment by starting the first and last lines in the comment block with an asterisk and exclamation mark.

*!
These lines
are ignored.
*! 

You may also put block comments around command lines to tell the QPL developer software to ignore them when it builds your web site. This can be useful when you want to temporarily ignore some commands in your QPL program.

*!
.MENU = OFF
*!

Here, the MENU command will be ignored because it is inside a comment block.

Text Lines

Text lines are used inside of various block commands, such as when defining the contents of your home page or the text of a question. These lines may start with any character in the first column other than a period or an asterisk.

You should not use any of the special formatting features that your word processor may provide, such as underlining or bolding.

You can, however, embed QPL format characters or HTML tags within your question text and answer lines to create this formatting. See Text Format Options.