Solved

Number of Decimal Places displayed

Posted on 2008-06-19
5
173 Views
Last Modified: 2010-04-16
Hi,

I'm grabbing some variables and doing some maths with them for the results to then be displayed. I've got this working fine. But if I have two prices, e.g £16.50 and £6.00, take them away from each other, I am getting the result of £10.5 and I would like £10.50 if possible?

Any ideas anyone?

Thanks,
AJ
if pricewas="n/a" then

pricesave="n/a"

else

pricesave=pricewas - costsqm

end if

Open in new window

0
Comment
Question by:Dave Robinson
  • 3
  • 2
5 Comments
 
LVL 2

Expert Comment

by:mraluminumsiding
ID: 21823984
That looks like VB, so:


pricesave = Round(pricewas - costsqm), 2)

Open in new window

0
 
LVL 2

Accepted Solution

by:
mraluminumsiding earned 50 total points
ID: 21824093
Duh, wrong function.
pricesave = FormatNumber((pricewas - costsqm), 2)

Open in new window

0
 
LVL 2

Author Comment

by:Dave Robinson
ID: 21829322
Thanks for the ideas mraluminumsiding Unfortunately i just get this error with that code
Microsoft VBScript compilation  error '800a0401'
 

Expected end of statement
 

/index.asp, line 266
 

costsqm2= FormatNumber(tilespersqm2 * price2), 2)

---------------------------------------------^

Open in new window

0
 
LVL 2

Expert Comment

by:mraluminumsiding
ID: 21832516
You need an extra parentheses in the beginning, right after FormatNumber.
0
 
LVL 2

Author Comment

by:Dave Robinson
ID: 22014940
Sorry its taken me a while to get back to your reply on this mraluminumsiding, I've been away. Thanks for the reply though.

What do you mean by parentheses? I'm not so hot on ASP, nor SQL Server.

Cheers
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction:   Welcome to my first article ever. To begin with, the reason I write this article.  I participated in a question on Experts Exchange about the start command in Windows and there were some discussion about the usage. The discussio…
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…

705 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now