This topic is locked

Decimal Places in Reports

8/22/2007 10:20:07 PM
ASPRunnerPro General questions
lefty author

I am using a report in my project . I have some columns that have totals . They are showing more than 2 decimal places . How can I limit this? (rounding)

Sergey Kornilov admin 8/23/2007

Set "View as" type of those fields to Number.

A
ac163601 8/24/2007

Sergey, jane,
Following advice on other topics, I have amended the field type to custom:
str = "<table width=100% bgcolor="

if strValue<=.9 then

str = str & "green"

end if
if strValue>.9 AND strValue<1.3 then

str = str & "gold"

end if

if strValue>=1.3 then

str = str & "red"

end if

str = str & "><tr><td>" & strValue & "</td></tr></table>"

strValue = str[/font]
How do I then turn these back to a % format?
Thanks

Andrew

Sergey Kornilov admin 8/24/2007

Set View as type to Percent?

A
ac163601 8/24/2007

Set View as type to Percent?


I need the conditional formatting provided by using the code:
str = "<table width=100% bgcolor="

if strValue<=.9 then

str = str & "green"

end if
if strValue>.9 AND strValue<1.3 then

str = str & "gold"

end if

if strValue>=1.3 then

str = str & "red"

end if

str = str & "><tr><td>" & strValue & "</td></tr></table>"

strValue = str
If I set view as to Percent, I lose the benefit of the coding. Is there an extra line or two of coding, which can turn the resulting value of the code above into %, or at least limit the number of characters after the decimal point?
Thanks

Andrew

Sergey Kornilov admin 8/25/2007

Andrew,
I see what you saying.
Try to put the following as a last line of your code:

strValue = "%" & FormatNumber(CDbl(str)*100,2)