Solved

Number of Decimal Places displayed

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

Introduction This tutorial will give you a fast look what you can do with WhizBase. I expect you already know how to work with HTML at least, and that you understand the basics of the internet and how the internet works. WhizBase is a server-s…
This tutorial will discuss the log-in process using WhizBase. In this article I assume you already know HTML. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you might look at some of my other articles abo…
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

773 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