Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Number of Decimal Places displayed

Posted on 2008-06-19
5
Medium Priority
?
194 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
[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
  • 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 200 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

Amazon Web Services EC2 Cheat Sheet

AWS EC2 is a core part of AWS’s cloud platform, allowing users to spin up virtual machines for a variety of tasks; however, EC2’s offerings can be overwhelming. Learn the basics with our new AWS cheat sheet – this time on EC2!

Question has a verified solution.

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

In this tutorial I will show you how to provide a dynamic RTF document on your website generated with data from your database. For this tutorial you will need Microsoft Word or WordPad, WhizBase and Microsoft Access. In this tutorial I will show …
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
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 …

722 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