Click here to Skip to main content
Licence CPOL
First Posted 24 Feb 2008
Views 16,494
Bookmarked 16 times

Rows Coloring in Crystal Reports

By | 24 Feb 2008 | Article
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)

About the Author

sameerfair


Quntech Pvt. Ltd
Pakistan Pakistan

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralMy vote of 1 PinmemberDaniel Nutu10:48 1 Feb '09  
Generalchange the font style at run time Pinmemberda_dhanaraj9:28 3 Nov '08  

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.

Permalink | Advertise | Privacy | Mobile
Web04 | 2.5.120517.1 | Last Updated 25 Feb 2008
Article Copyright 2008 by sameerfair
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid