Monday, January 26, 2009

Crystal Reports : Conditionally change font color

You can specify the color of any font in your report to change based upon a "condition".
A typical example would include making a sales total field "red" if it drops below a certain value.
Let's assume our Sales Total field is called "SalesTotal".
Step #1 : Right-click on the field in question and select Format Field.
Step #2 : Click on the "Font" tab.
Step #3 : Click on the "x-2" (formula) button next to Color.
Step #4 : Use the following fomula: if SalesTotal < 100 then crMaroon else crBlack

This formula forces the sales total to be drawn in red if it drops below 100, oherwise it stays black.

Pro Tip: When testing a condition to change the font, any fields on the report are available to use.

11 comments:

Anonymous said...

It is very helpful for me. Thanks a lot.

Anonymous said...

i want to change color on conditins in deatails value

where the price chnage it hilightesd with the reb color

i copmpare value with to prices in the query and one is use in details section where the details price change then its color change


any one help me on this proble


my id is mcavimal@gmail.com

Mangat said...

This is the most simple way for whom i'm looking.

Thanks for your HELP

Mangat Phogat

Anonymous said...

Thanks a lot...

Anonymous said...

Hello... thanks a lot for your help :)

Anonymous said...

Awesome help guide, got exactly what I needed from it!

meh420 said...

I am creating test report for a pathology lab so i have to print all test details in it...

i have to format the test result value if it is out of bound which is different for every test.

so if the test value is out of bound then display in red colour ..

In highlight expert i have to give a specific value but in my case the bound values are different fr each test ...

Igor Kamp said...

This has been a great help. Thanks for taking the effort to put this up!

Chandan Sharma said...

g8 help for me. Thanks

Anonymous said...

Crystal Reports Font Encoder,
http://www.keepautomation.com/font_tools/crystal_reports_ufl_barcode_font_encoder.html

Anonymous said...

huge help! works perfect, thank you!