The Big Idea

We want to be able to survey users. We want a non-technical person to be able to design surveys from HTML forms. We want someone who is not a site-admin to be able to review answers (we just give them admin over the survey package.)

Data-Model

We use the following tables: The philosophy about storing the users responses is to use one single table to store all responses, i.e., we do not create a new table when we create a new survey. In order to make it possible to store all kinds of data in one table, we give the survey_question_responses table five columns.

	-- if the user picked a canned response
	choice_id		references survey_question_choices,
	boolean_answer		char(1) check(boolean_answer in ('t','f')),
	clob_answer		clob,
	number_answer		number,
	attachment_answer       integer references cr_revisions(revision_id) 
	varchar_answer		varchar(4000),
Only one of the columns will be not-null.

Why the CLOB in addition to the varchar? The CLOB is necessary when people are using this system for proposal solicitation (people might type more than 4000 characters).

NOTE: Postgresql uses a text column in place of CLOB.

Attachment_answer allows for uploaded files to be stored in the content-repository

.