Skip to content

Instantly share code, notes, and snippets.

Created February 17, 2013 18:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/4972619 to your computer and use it in GitHub Desktop.
Save anonymous/4972619 to your computer and use it in GitHub Desktop.
<cfscript>
//get list of keyword and counts for this question
qryKeywordCount = application.gatewayResult.getResultsByQuestion (
campaignID = url.campaignID,
smsID = url.smsID
);
//get the total number of votes for this question
qryKeywordTotal = application.gatewayResult.getTotalByQuestion(smsID = url.smsID);
//get the top keyword result for this quetsion
qryTopKeyword = application.gatewayResult.getTopResultByQuestion(smsID = url.smsID);
//loop through the query to get the % of votes for the selected keyword
for (i = 1; i <= qryKeywordCount.recordCount; i = i + 1)
{
"variables.#qryKeywordCount.keyword[i]#_percent" = numberFormat((qryKeywordCount.keywordCount[i] / qryKeywordTotal.keywordTotal)*100, '99');
}
</cfscript>
<!--- display the keywords and their vote count --->
<cfoutput query="qryKeywordCount">
<cfif not compare(keyword,qryTopKeyword.keyword)>
<cfset variables.lineGraphic = "line_orange.png" />
<cfelse>
<cfset variables.lineGraphic = "line_blue.png" />
</cfif>
<label>#keyword# - #keywordDesc#</label><br />
<span style="padding-left:35px;">
<img alt="#keyword# - #keywordDesc# - #evaluate('variables.#keyword#_percent')#%" src="../images/#variables.lineGraphic#" style="width:#evaluate('variables.#keyword#_percent')#%; height:55px;vertical-align:middle" />
- #keywordCount#<br />
</span>
</cfoutput>
<!-- display the total number of votes for this question -->
<div style="margin-top:30px;"><label>Total Votes: <cfoutput>#qryKeywordTotal.keywordTotal#</cfoutput></label> </div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment