Hi Jamari
last week i posted this, I'm not sure why it doesn't display here.
anyway this is the same content.
Your suggestion seems to be ok.
But how to implement in my case where
i have columns like
i_name,i_1a,i_1b,i_2a,i_2b
the average of 1 (i_1a+i_1b/2)
the average of 2 (i_2a+i_2b+i_2c+i_2d/4)
the average of 3 (i_3a+i_3b/2)
and for 4 & 5 all in percentage.
how to extract and convert the individual values,
poor to 1,fair to 2,good to 3 and excellent to 4.
the following is not working..
<cfquery name="my" datasource="tcsvss">
select * from isurvey where i_name = 'xxx' and..
</cfquery>
<cfoutput query="my">
<cfif (#i_1a# contains "POOR") or (#i_1b# contains "POOR") or (#i_2a# contains "POOR") or >
<cfset i_1a = 1>
<cfset i_1b = 1>
<cfset i_2a = 1>
..
..
<cfelseif (#i_1a# contains "FAIR") or (#i_1b# contains "FAIR") or (#i_2a# contains "FAIR") or >
<cfset i_1a = 2>
<cfset i_1b = 2>
<cfset i_2a = 2>
..
..
</cfif>
</cfoutput>
pls solve the above.(any other method???)
Thanks.
Main Topics
Browse All Topics





by: iamariPosted on 2001-12-05 at 05:37:45ID: 6667172
i think it would be easier to update the db first, and then extract the values, like:
/myQuery.m yTotal*100 > /myQuery.m yTotal*100 > /myQuery.m yTotal*100 >
<br>
<cfquery name="myQuery" datasource="test">
select count(myField) as myTotal,
(select count(myField) from myTable where myField='poor') as poor,
(select count(myField) from myTable where myField='fair') as fair,
(select count(myField) from myTable where myField='good') as good
from myTable
</cfquery>
<cfset myPoorPercent=myQuery.poor
<cfset myFairPercent=myQuery.fair
<cfset myGoodPercent=myQuery.good
<cfoutput>#myPoorPercent#%
#myFairPercent#%<br>
#myGoodPercent#%
</cfoutput>