Forums: Number format - Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

Number format Number format Rate Topic: -----

#1 User is offline   swat 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 299
  • Joined: 18-June 03

Post icon  Posted 23 June 2003 - 08:04 PM

hello,

I would like to display (#.###) stile some of my DB let say if it is 1 , it should be displayed like this (1.000) all the column should be the same format ex:
2.333
0.002
0.000
1.003
0.120
however I run the code and I cant get this format it just eliminate the 0's.
Is there any way I can display the way I want .

Thank you

swat
swat
0

#2 User is offline   admin 

  • Administrator
  • PipPipPip
  • Group: Admin
  • Posts: 13703
  • Joined: 03-February 03

Posted 24 June 2003 - 12:00 AM

Swat,

here is how you can do this:

1. Build set of ASP pages using ASPRunner.

2. Open include/aspfunctions.asp file and insert the following two lines into GetData function:
if Format = FORMAT_NUMBER and GetData<>"" _ 
  then GetData = FormatNumber(GetData,3)


3. Add the following line to include/variables.asp:
Const FORMAT_NUMBER = "Number"


4. In ..._list.asp file replace
Response.Write GetData(rsData.Fields("ID"), "")

with
Response.Write GetData(rsData.Fields("ID"), FORMAT_NUMBER)

where ID is the field that you like to be formatted. Repeat this replacement for each field that you like to format ###.### way.


I hope this helps.

Best regards,
Sergey Kornilov
Best regards,
Sergey Kornilov
0

Page 1 of 1
  • You cannot start a new topic
  • This topic is locked