Solved

Number of Decimal Places displayed

Posted on 2008-06-19
5
184 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Making a simple AJAX shopping cart Couple years ago I made my first shopping cart, I used iframe and JavaScript, it was very good at that time, there were no sessions or AJAX, I used cookies on clients machine. Today we have more advanced techno…
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 modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

685 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