This topic is locked

Change color of Font based on database value

4/11/2010 9:31:25 AM
ASPRunnerPro General questions
C
Conrunner author

Hello

I have a table which looks like this...
Series1 Series2 Series3 S2C S3C

335 213 218 Red Green
S2C is the color I want the font for the Series2 result (213) to be on the list page.

S3C is the color I want the font for the Series3 result (218) to be on the list page.
S2C and S23 will not always be Red and Green respectively however - They are generated by a CASE query in the database and S2C is currently Red because the Series2 value is less than the Series1 value. S3C is currently Green because the Series3 value is greater than the Series2 value.
Is there any way of getting the ASP page to look at the S2C and S3C colors in the database and then using these colors to display the result for Series2 (213) in Red and the result for Series3 (218) in Green on the list page?
I am very bad at custom coding so if you have any answers I would be very grateful if you could explain as fully as is possible.
Many Thanks

Con.

Sergey Kornilov admin 4/15/2010

You can set 'View as' type of Series2 and Series3 fields to 'Custom' and use the following code respectively:

value = "<font color='" & data("S2C") & "'>" & value & "</font>"


and

value = "<font color='" & data("S3C") & "'>" & value & "</font>"