?
Solved

lsnumberformat Question?

Posted on 2002-03-16
3
Medium Priority
?
219 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 200 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

Understanding Web Applications

Without even knowing it, most of us are using web applications on a daily basis. Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We often confuse these web applications tools for websites.  So, what is the difference?

Question has a verified solution.

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

In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

650 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