[Zope] Re: QSurvey

Jim Washington jwashin@vt.edu
Sat, 22 Apr 2000 10:41:39 -0400


Hi, Jorge

Thanks, and I am glad you proposed the question.  I am posting this back
to the Zope list as well, since I figure others may have the same
question.

The results of submission, which are QSurveyResultsItems, all will
appear in a QSurveyResultsFolder named RESULTS, which is created
automatically within your QSurvey.  Each QSurveyResultsItem is just a
container for properties, which are named using the ids of the
Questions.

The id of a QSurveyResultsItem is taken from AUTHENTICATED_USER and the
date/time, plus a random number in case multiple users with the same
login name start the survey within the same second.

The way to get the survey results is the same way you get properties
from any other zope object.

But first, a minor bug-fix.  We have run into the ZClass ID bug
(http://www.zope.org/Members/AlexR/ZClassIDBug), and the fix is to edit
/Control_Panel / Products / QSurvey / QSurveyClass / methods /
filethedata.

Six lines down, find the statement: 

<dtml-with "QSurveyResultsItemClass.createInObjectManager(id=surveyid,
REQUEST=REQUEST)">   

Right after this statement, add the following:

 <dtml-call "setName(surveyid)">

(I will upload a fixed copy of the .zexp file as soon as I can, but I
cannot login to zope.org at the moment)

Now, delete the RESULTS folder, and all new QSurveyResultsItems will
have ids to allow code like the following:

<dtml-with RESULTS>
<table>
<dtml-in "objectItems('QSurveyResultsItem')">
<dtml-if aQuestionName>
<tr><td><dtml-var id></td><td><dtml-var aQuestionName></td></tr>
</dtml-if>
</dtml-in>
</table>
</dtml-with>

Replace aQuestionName with the id of any question in the QSurvey, and it
will display all the answers to a particular question.  Of course, this
is a very simple example; you may do complicated things like calculating
a distribution if you want.  I have not decided what a good default
display should look like, so I am interested in what you and other users
come up with to meet your needs.

Hope this helps,

-- Jim Washington

Jorge Magalhaes wrote:
> 
> Hi:
> 
> Congratulations. Good job. QSurvey it's  a great product but i don't
> know how i can see the results.
> 
> Thanks very much