Print Page | Close Window

how can i change text color based on result value

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=2758
Printed Date: 26 Apr 2024 at 1:28pm


Topic: how can i change text color based on result value
Posted By: ji_stan
Subject: how can i change text color based on result value
Date Posted: 30 Mar 2008 at 5:04am

hi
how can i write a formulae that changes the color of the text based on the value. ie, results from a database return values of sales made this week.
example: teddy bears: Mon   Tue   Wed  Thurs
____________________5___3____1____0
__________barbie dolls:4____2____2____1

how can i change the color of the numbers to RED if they are 2 or lower on the report?   so if in case of teddy bears,wed & thurs results would be in Red, mon and tue in default black.

anyone know how to go about doing this?
cheers.



-------------
gg



Replies:
Posted By: BrianBischof
Date Posted: 30 Mar 2008 at 1:34pm
This is pretty easy and I give lots of examples of conditional formatting of reports in my Encyclopedia book. On the report object, right-click on it and select Format Object. Find the property you want to modify (Font tab, Color) and click on the Formula Workshop button to the right (it has a pencil on it). Then enter something like the following formula:
if {table.salesfield}<=2 then
    crRed
else
   DefaultAttribute;

You can find out more about my books at http://www.amazon.com/exec/obidos/ASIN/0974953601/bischofsystem-20 - Amazon.com or reading the http://members.crystalreportsbook.com - Crystal Reports eBooks online.


-------------
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>



Print Page | Close Window