Well  I have done it differently,but here is an idea

May have to create a field for 1,2,3,4 and 5 (such as Opt1Count, Opt2Count,
etc).

Increment the field by one when the user submits the survey.

Percentage:

What I would do is:

<CFSET Num1Percent=#Evaluate((Opt1Count/Q1y)*100)#>
<CFSET Num2Percent=#Evaluate((Opt2Count/Q1y)*100)#>
etc...

then when displaying percentage:

<CFOUTPUT>
1: #NumberFormat(Num1Percent)#%  2:#NumberFormat(num2Percent)#% etc....
</CFOUTPUT>

I bet that is not the best way to do it,but hopefully it can help somewhat.



Jim Watkins <[EMAIL PROTECTED]> wrote in message
news:004101c17504$c47c6450$0100a8c0@jimdell...
> I have responses from a survey stored in an Access Database.  The
> responses
> are represented as 1,2,3,4, or 5 and are stored under columns labeled Q1
> through Q30 which represent the questions on the survey. I have no
> problem
> grouping and doing a SUM or an AVG.  What I am struggling with is
> getting
> percentages.
>
> Specifcally, I want to know what percentage of all the responses are
> ones,
> or twos, or threes, or fours, or fives. The test output is at:
> http://www.ngtcollege.org/survey/courseeval/courseevaldbg.cfm  I need to
> display something like:
> 1 = 25%, 2 = 15%, 3 = 40%, 4 = 20%, 5 = 0%
>
> A sample of my code is:
>
> <CFQUERY Name="eval" DataSource="survey">
> SELECT coursename,term,term1,
> SUM(Q1) AS Q1y,
> AVG(Q1) AS Q1x,
> SUM(Q2) AS Q2y,
> AVG(Q2) AS Q2x,
> [repeated through Q30]
>
> count (*) as num
> FROM courseeval
> GROUP BY coursename,term,term1
> </CFQUERY>
>
> Sure would appreciate any help you can give me on this.
>
> Jim Watkins
>
>
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to