Home All Groups Group Topic Archive Search About

Formatting Numbers in Database Results

Author
3 Feb 2009 11:08 PM
RoadKill
Okay, so I have several averages that are being displayed in my results page.
How can I get it formatted to two decimal places instead of the 14 that it
presently has?

4.78 looks a lot cleaner than 4.77777777777778

We are running V2003.

Thank you

Author
3 Feb 2009 11:16 PM
Karl E. Peterson
RoadKill wrote:
> Okay, so I have several averages that are being displayed in my results page.
> How can I get it formatted to two decimal places instead of the 14 that it
> presently has?
>
> 4.78 looks a lot cleaner than 4.77777777777778

What are you using to read from the database?

If ASP/VBS, use FormatNumber(TheValue, 2).

http://www.w3schools.com/vbScript/func_formatnumber.asp
--
..NET: It's About Trust!
http://vfred.mvps.org
Are all your drivers up to date? click for free checkup

Author
3 Feb 2009 11:50 PM
RoadKill
It is ASP via the Wizard. Here is one of the averages:

<td align="center">
<!--webbot bot="DatabaseResultColumn"
s-columnnames="Coach,AvgOfQuestionOne,AvgOfQuestionTwo,AvgOfQuestionThree,AvgOfQuestionFour,AvgOfQuestionFive,AvgOfQuestionSix,AvgOfQuestionSeven,AvgOfQuestionEight,CountOfID"
s-column="AvgOfQuestionSeven" b-tableformat="TRUE" b-hashtml="FALSE"
b-makelink="FALSE" clientside b-MenuFormat preview="<font
size="-1">&lt;&lt;</font>AvgOfQuestionSeven<font size="-1">&gt;&gt;</font>"
startspan --><%=FP_FieldVal(fp_rs,"AvgOfQuestionSeven")%><!--webbot
bot="DatabaseResultColumn" endspan i-checksum="59161" --></td>


Show quoteHide quote
"Karl E. Peterson" wrote:

> RoadKill wrote:
> > Okay, so I have several averages that are being displayed in my results page.
> > How can I get it formatted to two decimal places instead of the 14 that it
> > presently has?
> >
> > 4.78 looks a lot cleaner than 4.77777777777778
>
> What are you using to read from the database?
>
> If ASP/VBS, use FormatNumber(TheValue, 2).
>
> http://www.w3schools.com/vbScript/func_formatnumber.asp
> --
> ..NET: It's About Trust!
http://vfred.mvps.org
>
>
>
Author
4 Feb 2009 12:02 AM
Karl E. Peterson
RoadKill wrote:
> It is ASP via the Wizard. Here is one of the averages:
>
> <td align="center">
> <!--webbot bot="DatabaseResultColumn"
> s-columnnames="Coach,AvgOfQuestionOne,AvgOfQuestionTwo,AvgOfQuestionThree,AvgOfQuestionFour,AvgOfQuestionFive,AvgOfQuestionSix,AvgOfQuestionSeven,AvgOfQuestionEight,CountOfID"
> s-column="AvgOfQuestionSeven" b-tableformat="TRUE" b-hashtml="FALSE"
> b-makelink="FALSE" clientside b-MenuFormat preview="<font
> size="-1">&lt;&lt;</font>AvgOfQuestionSeven<font size="-1">&gt;&gt;</font>"
> startspan --><%=FP_FieldVal(fp_rs,"AvgOfQuestionSeven")%><!--webbot
> bot="DatabaseResultColumn" endspan i-checksum="59161" --></td>

Gonna have to shift into manual at some point, unless you're happy with being Wizzed
upon.

   <%=FormatNumber(FP_FieldVal(fp_rs,"AvgOfQuestionSeven"), 2)%>

--
..NET: It's About Trust!
http://vfred.mvps.org



Show quoteHide quote
> "Karl E. Peterson" wrote:
>> RoadKill wrote:
>> > Okay, so I have several averages that are being displayed in my results page.
>> > How can I get it formatted to two decimal places instead of the 14 that it
>> > presently has?
>> >
>> > 4.78 looks a lot cleaner than 4.77777777777778
>>
>> What are you using to read from the database?
>>
>> If ASP/VBS, use FormatNumber(TheValue, 2).
>>
>> http://www.w3schools.com/vbScript/func_formatnumber.asp
>> --
>> ..NET: It's About Trust!
>>  http://vfred.mvps.org
Author
4 Feb 2009 12:12 AM
RoadKill
Cool, that works. I hear ya and am rebuilding it without the Wizard now.

Thanks for the help.


Show quoteHide quote
"Karl E. Peterson" wrote:

> RoadKill wrote:
> > It is ASP via the Wizard. Here is one of the averages:
> >
> > <td align="center">
> > <!--webbot bot="DatabaseResultColumn"
> > s-columnnames="Coach,AvgOfQuestionOne,AvgOfQuestionTwo,AvgOfQuestionThree,AvgOfQuestionFour,AvgOfQuestionFive,AvgOfQuestionSix,AvgOfQuestionSeven,AvgOfQuestionEight,CountOfID"
> > s-column="AvgOfQuestionSeven" b-tableformat="TRUE" b-hashtml="FALSE"
> > b-makelink="FALSE" clientside b-MenuFormat preview="<font
> > size="-1"><<</font>AvgOfQuestionSeven<font size="-1">>></font>"
> > startspan --><%=FP_FieldVal(fp_rs,"AvgOfQuestionSeven")%><!--webbot
> > bot="DatabaseResultColumn" endspan i-checksum="59161" --></td>
>
> Gonna have to shift into manual at some point, unless you're happy with being Wizzed
> upon.
>
>    <%=FormatNumber(FP_FieldVal(fp_rs,"AvgOfQuestionSeven"), 2)%>
>
> --
> ..NET: It's About Trust!
http://vfred.mvps.org
>
>
>
> > "Karl E. Peterson" wrote:
> >> RoadKill wrote:
> >> > Okay, so I have several averages that are being displayed in my results page.
> >> > How can I get it formatted to two decimal places instead of the 14 that it
> >> > presently has?
> >> >
> >> > 4.78 looks a lot cleaner than 4.77777777777778
> >>
> >> What are you using to read from the database?
> >>
> >> If ASP/VBS, use FormatNumber(TheValue, 2).
> >>
> >> http://www.w3schools.com/vbScript/func_formatnumber.asp
> >> --
> >> ..NET: It's About Trust!
> >>  http://vfred.mvps.org
>
>
>
>

Bookmark and Share