Solved

lsnumberformat Question?

Posted on 2002-03-16
3
217 Views
Last Modified: 2013-12-24
Can someone help me in this code:

<cfoutput query="GetAllAnswers">
<cfif #GetTotalRespondees.TotalVotes# is not 0>
<cfset Percentage= lsnumberformat(((
#GetAllAnswers.Results#/
#GetTotalRespondees.TotalVotes#)*100),
"999.0")>
<cfelse>
<cfset Percentage= 0>
</cfif>

when i excute it, it gives me this error message "Cannot convert 49.0 to number.

Please, check the ColdFusion manual for the allowed conversions between data types"

Note 49 is the totall votes.
0
Comment
Question by:iqbalwali
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 19

Accepted Solution

by:
cheekycj earned 50 total points
ID: 6874286
Perhaps it considers your data to be strings instead of numbers

Check it this way:
<cfoutput query="GetAllAnswers">
<cfif IsNumeric(GetTotalRespondees.TotalVotes) AND IsNumeric(GetAllAnswers.Results)
AND GetTotalRespondees.TotalVotes NEQ 0>
<cfset Percentage= lsnumberformat(((
GetAllAnswers.Results/
GetTotalRespondees.TotalVotes)*100),
"999.0")>
<cfelse>
  Numbers were either 0 or not numeric: #GetTotalRespondees.TotalVotes#,#GetAllAnswers.Results#<br>
<cfset Percentage= 0>
</cfif>
</cfoutput>
0
 

Author Comment

by:iqbalwali
ID: 6874986
Thanx budy!
0
 
LVL 19

Expert Comment

by:cheekycj
ID: 6875916
No problem.  Glad I could help and Thanx for the "A".
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A web service (http://en.wikipedia.org/wiki/Web_service) is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question