• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 203
  • Last Modified:

Number of Decimal Places displayed

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
Dave Robinson
Asked:
Dave Robinson
  • 3
  • 2
1 Solution
 
mraluminumsidingCommented:
That looks like VB, so:


pricesave = Round(pricewas - costsqm), 2)

Open in new window

0
 
mraluminumsidingCommented:
Duh, wrong function.
pricesave = FormatNumber((pricewas - costsqm), 2)

Open in new window

0
 
Dave RobinsonAuthor Commented:
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
 
mraluminumsidingCommented:
You need an extra parentheses in the beginning, right after FormatNumber.
0
 
Dave RobinsonAuthor Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now