Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dynamic reports need new color for negative numbers

Status
Not open for further replies.

CDNJungler

Programmer
Jul 16, 2002
11
CA
Problem....I have reports that are generated dynamically by data in the database and calculations in stored procedures and asp pages. What I want is to be able to have the negative value numbers to be in red and the posititve numbers to be in black( which right now all numbers are). I thought a simple if statement would work but either it doesn't or I'm just not putting it in the right place. If anyone could give me a lead or solution on this it'd be greatly apprieciated!! Thanks
 
[tt]How about some code to better help you.

or pehaps you need something like this (my code may not be accurate tho) but u get the idea.
<%
if field1 < 0
response.write &quot;<font color=&quot;red&quot;>field2</formt>&quot;
end if
%>

[tt]&quot;A Successful man is one who can build a firm foundation with the bricks that others throw at him&quot;[/tt]
[noevil]
 
THis is exactly what I've been trying. I just musn't be puuting the code in the proper place. I'll keep tryin. Thanks Tony
 
We must be family based on our name but I must be from the non-Jungler side. :)
 
Try this:

<%
if field1 < 0
response.write &quot;<font color = red>field2</font>&quot;
end if
%>

If that doesn't work, add single quotes around 'red'. HTH Insanity is merely a state of mind while crazy people have a mind of their own.
 
It might be that you have to cast your value, to ensure it is a number and not a string. Try something like this:

Code:
if cDbl(value) < 0 then
   Response.Write &quot;<font color=red>&quot; & value & &quot;</font>&quot;
else
   Response.Write &quot;<font color=black>&quot; & value & &quot;</font>&quot;
end if

Palooka
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top