This topic is locked

Number format

6/23/2003 4:04:00 PM
ASPRunnerPro General questions
swat author

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

admin 6/23/2003

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