2010-10-07
QPL Reference Manual

This example shows how to use various options with a COLUMNS layout to adjust the size of the columns so that the questions fit without being distorted when displayed in a browser. Here, I will make a six-column, three-row layout where the first column holds the stub of a question and the cells to the right hold NUMBER questions, spreadsheet-style.

Here is a snapshot of the end result.

Finished six-column, three-row COLUMN layout

As you can see, putting a six-column layout in the default page size of 770 pixels is going to be a tight fit. The menu on the left takes up 150 pixels, leaving only 620 pixels for the COLUMNS layout (103 pixels for each column if divided evenly among them).

Here is the QPL program to create the layout using only the default settings.

.MENU=ON
.PAGEWIDTH=770
.PAGEGUTTER=35

...

.QUESTION, TYPE=VOID
What were the number of changes that occurred for each of the following requirements?  

Please enter number of changes in each box below.
.ANSWER
(Enter 0 if there are no changes. Leave it blank if you do not know.)
.NEXT

.COLUMNS=6
.COLUMNSHEADINGS=ON
.QNUMBERING=OFF

* Row 1 

.QUESTION, TYPE=VOID
Key Performance Parameters (KPPs)
.ANSWER
.NEXT

.QUESTION, TYPE=NUMBER
New
.ANSWER=5
.NEXT

.QUESTION, TYPE=NUMBER
Deleted
.ANSWER=5
.NEXT

.QUESTION, TYPE=NUMBER
Deferred
.ANSWER=5
.NEXT

.QUESTION, TYPE=NUMBER
Decreased
.ANSWER=5
.NEXT

.QUESTION, TYPE=NUMBER
Enhanced
.ANSWER=5
.NEXT

* Row 2

.QUESTION, TYPE=VOID
Key System Attributes (KSAs)
.ANSWER
.NEXT

.QUESTION, TYPE=NUMBER 
New
.ANSWER=5
.NEXT

.QUESTION, TYPE=NUMBER 
Deleted
.ANSWER=5
.NEXT

.QUESTION, TYPE=NUMBER 
Deferred
.ANSWER=5
.NEXT

.QUESTION, TYPE=NUMBER 
Decreased
.ANSWER=5
.NEXT

.QUESTION, TYPE=NUMBER
Enhanced
.ANSWER=5
.NEXT

* Row 3

.QUESTION, TYPE=VOID
Requirements in system performance specification (shall statements)
.ANSWER
.NEXT

.QUESTION, TYPE=NUMBER
New
.ANSWER=5
.NEXT

.QUESTION, TYPE=NUMBER 
Deleted
.ANSWER=5
.NEXT

.QUESTION, TYPE=NUMBER 
Deferred
.ANSWER=5
.NEXT

.QUESTION, TYPE=NUMBER
Decreased
.ANSWER=5
.NEXT

.QUESTION, TYPE=NUMBER 
Enhanced
.ANSWER=5
.NEXT
		
.QNUMBERING=ON
.COLUMNS=OFF

And here is how it will appear when compiled and displayed in a browser.

Layout using only the default settings

As you can see, there are problems with the text in the left column lining up consistently, and the spanning header line seems to be too short. Actually, the problem caused by words in the stub column, such as "requirements," and "performance," that are too big for the size of the column that has been defined. The text in the second row has only short words so the browser was able to wrap them within the available width.

The next snapshot shows this same page with the table cells highlighted. The red lines show the cells in the COLUMNS layout, and the green lines show the cells in the table used to layout the question in each cell. The left green cell is the space used for the question number (i.e., the PAGEGUTTER) which should be 35 pixels wide.

Show question with table cell boundaries

There are several solutions to this problem. The easiest would be to increase the PAGEWIDTH from the default of 770 to 900 pixels or more. Then each column would be wider, and perhaps the first would be wide enough to fit the long words.

Or you could flip the columns and the rows. Then, instead of having six columns, you would only have four columns and each of these columns would be wider.

Another solution is to make the first column wider and reduce the size of the other columns.

In the example below, I have specifically set the WIDTH for each question in the first row of the COLUMNS layout. The remaining rows of the COLUMNS layout will automatically use these same settings so it is not necessary to set those too.

First, I set the VOID text stub question 150 pixels wide (the same width as the menu on the left) by guessing that would be about the right size to wrap the text without distortion.

Next, I calculated the WIDTH for each of the NUMBER question columns:

(770 px page with - 150 px menu - 150 px first question)
-------------------------------------------------------- = 94 px per column
                       5 columns

Since I'm not numbering the NUMBER questions, I can also use use the INDENT command to out-dent the space for the number input field into the the space that is normally reserved for the question number. Since the space used for the question number (PAGEGUTTER) is set to 35 pixels, I can use a negative INDENT of -34 to out-dent the question area making it wider without increasing the width of the COLUMNS column.

Here is the revised program.

.MENU=ON
.PAGEWIDTH=770
.PAGEGUTTER=35

...

.QUESTION, TYPE=VOID
What were the number of changes that occurred for each of the following requirements? 

Please enter number of changes in each box below.
.ANSWER
(Enter 0 if there are no changes. Leave it blank if you do not know.)
.NEXT

.COLUMNS=6
.COLUMNSHEADINGS=ON
.COLUMNSROWSHADING=ON
.QNUMBERING=OFF

* (770 page width - 150 menu width - 150 first column width)/5 columns=94 pixels per column

* Row 1

.QUESTION, TYPE=VOID, WIDTH=150
Key Performance Parameters (KPPs)
.ANSWER
.NEXT

.QUESTION, TYPE=NUMBER, INDENT=-34, WIDTH=94, VALIGN=MIDDLE
.LABEL="Key Performance Parameters (KPPs) - New"
New
.ANSWER=5
.NEXT

.QUESTION, TYPE=NUMBER, INDENT=-34, WIDTH=94, VALIGN=MIDDLE
.LABEL="Key Performance Parameters (KPPs) - Deleted"
Deleted
.ANSWER=5
.NEXT

.QUESTION, TYPE=NUMBER, INDENT=-34, WIDTH=94, VALIGN=MIDDLE
.LABEL="Key Performance Parameters (KPPs) - Deferred"
Deferred
.ANSWER=5
.NEXT

.QUESTION, TYPE=NUMBER, INDENT=-34 , WIDTH=94, VALIGN=MIDDLE
.LABEL="Key Performance Parameters (KPPs) - Decreased"
Decreased
.ANSWER=5
.NEXT

.QUESTION, TYPE=NUMBER, INDENT=-34, WIDTH=94, VALIGN=MIDDLE
.LABEL="Key Performance Parameters (KPPs) - Enhanced"
Enhanced
.ANSWER=5
.NEXT

* Row 2

.QUESTION, TYPE=VOID
Key System Attributes (KSAs)
.ANSWER
.NEXT

.QUESTION, TYPE=NUMBER 
.LABEL="Key System Attributes (KSAs) - New"
New
.ANSWER=5
.NEXT

.QUESTION, TYPE=NUMBER 
.LABEL="Key System Attributes (KSAs) - Deleted"
Deleted
.ANSWER=5
.NEXT

.QUESTION, TYPE=NUMBER 
.LABEL="Key System Attributes (KSAs) - Deferred"
Deferred
.ANSWER=5
.NEXT

.QUESTION, TYPE=NUMBER 
.LABEL="Key System Attributes (KSAs) - Decreased"
Decreased
.ANSWER=5
.NEXT

.QUESTION, TYPE=NUMBER
.LABEL="Key System Attributes (KSAs) - Enhanced"
Enhanced
.ANSWER=5
.NEXT

* Row 3

.QUESTION, TYPE=VOID
Requirements in system performance specification (shall statements)
.ANSWER
.NEXT

.QUESTION, TYPE=NUMBER
.LABEL="Requirements in system performance specification (shall statements) - New"
New
.ANSWER=5
.NEXT

.QUESTION, TYPE=NUMBER 
.LABEL="Requirements in system performance specification (shall statements) - Deleted"
Deleted
.ANSWER=5
.NEXT

.QUESTION, TYPE=NUMBER 
.LABEL="Requirements in system performance specification (shall statements) - Deferred"
Deferred
.ANSWER=5
.NEXT

.QUESTION, TYPE=NUMBER
.LABEL="Requirements in system performance specification (shall statements) - Decreased"
Decreased
.ANSWER=5
.NEXT


.QUESTION, TYPE=NUMBER 
.LABEL="Requirements in system performance specification (shall statements) - Enhanced"
Enhanced
.ANSWER=5
.NEXT
		
.QNUMBERING=ON
.COLUMNS=OFF

While I was here, I also used the LABEL command to create a special label for each question that will be used when a SAS or SPSS analysis program is created by the QPL system. Since many of the questions had the same question text, such as "Deferred," this will make it easier to identify each question later when analyzing the results.

I also used the VALIGN command to float the input fields vertically in the MIDDLE of each COLUMNS row.

The next snapshot shows how the revised COLUMNS layout will appear when compiled and displayed in a browser. Note that first column is now wide enough to be displayed without distortion and the NUMBER columns appear to be tighter together since the size of the question number space was reduced.

Revised COLUMNS layout with table cells highlighted