Click here to Skip to main content
11,702,130 members (66,066 online)
Click here to Skip to main content

Rows Coloring in Crystal Reports

, 24 Feb 2008 CPOL 29.6K 18
Rate this:
Please Sign up or sign in to vote.
The article intends to show how to color rows in Crystal Reports depending on the business requirement which might arise

Introduction

During development there are chances that a person might encounter a problem of how to display colored rows in a crystal report, where colors themselves might actually represent something. I encountered this problem and was searching for solutions on the web but couldn’t find any. But in the end I cracked it, so I thought why not share it, so here goes.

CRTutorial2.jpg


Details

Shown above is an extraction from the report I was creating. To achieve such functionality you’d have to open the Section Expert from the Details Section. Then select the Color tab and then click on the formula button.

CRTutorial3.jpg

This would open the Formula Editor where you can specify the different conditions on to which the appropriate colors can be displayed. For more details on the available colors expand the Functions tree item in the Functions Tree, and look for the Color Constants tree item. Expanding it would reveal the list of supported colors.

CRTutorial1.jpg

The formula that I have used here is as follows:

if({AgingList.Total}>({AgingList.Principal}+{AgingList.Profit})) then Crgreen
else if({AgingList.Total}=0) then Crblue
else if({AgingList.Total}<({AgingList.Principal}+{AgingList.Profit})) then CrYellow
else NoColor

(Note: Don’t forget to assign the NoColor color to the rows which do not fit to the requirements for the coloured lines else they may defaultly be displayed as blacked out.)

Save the report and Play. If all conditions satisfied you should be able to see the desired result.

Conclusion

This procedure should solve the problem of colored rows where ever intended in the report.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Sameer Siddiqui
Team Leader CodeAesthetics
Pakistan Pakistan
A small time software engineer with big time ideas. Helping others get their ideas on the road so that some day I can fuel mine.

Wannabe Software Designer, work in progress, obsessed with Aesthetics especially of Engineering.

Having spent over 8 years writing software professionally I have, atleast tried to help, many companies build and improve on their existing business implementations. Having gone solo for a few years now, I am constantly on the look out for people with problems looking for someone to help solve them whilst building a strong lasting professional relationship in the process.

You may also be interested in...

Comments and Discussions

 
Generalthanks Pin
anis_sg7-Apr-14 12:35
memberanis_sg7-Apr-14 12:35 
GeneralMy vote of 1 Pin
Daniel Nutu1-Feb-09 10:48
memberDaniel Nutu1-Feb-09 10:48 
Generalchange the font style at run time Pin
da_dhanaraj3-Nov-08 9:28
memberda_dhanaraj3-Nov-08 9:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150819.1 | Last Updated 25 Feb 2008
Article Copyright 2008 by Sameer Siddiqui
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid