Crystal Reporting Tips – Alternate Line Shading

    

Crystal Reporting Tips – Alternate Line ShadingFor those of you brave enough to delve into the Crystal report-writing world, here is a helpful tip for reports that have many lines of details.  Don’t you find them hard to read sometimes? 

Wouldn’t it be nice if, like in the newer versions of Sage ERP, the lines alternated colour – white, grey, white, grey...?  It’s easy.

Here is an example of a basic Customer Contact List.  Notice it gets hard to read as you move down the page as it is all white and there are no lines.

Crystal Reporting Tips

To get alternate line shading at the detail level, you have to add a formula into Detail section in Crystal.

  • Go to Report > Section Expert (or right-click on the left, section area)
  • Click on Details on the left and switch to the Color tab on the right
  • Click on the formula button:
Crystal Reporting Tips 2
  •  Copy/type the following formula in:

select RecordNumber mod 2
case 0: crWhite
case 1: color(222,222,222)

  • Click Save and Close
  • Click OK to close the Section Expert window

 Here is the new report:

Crystal Reporting Tips –3
Your shading doesn’t have to be grey and white.  You can use different colours!  The colours that Crystal uses are: crBlack, crMaroon, crGreen, crOlive, crNavy, crPurple, crTeal, crGray, crSilver, crRed, crLime, crYellow, crBlue, crFuchsia, crAqua, crWhite.

This is how to do alternate line shading in the DETAIL section.  You can also do this by the Groups (such as Customer Group in the report above). 
 
Maybe you want the first group to be grey, second group to be yellow, etc.  To do this, change the DETAIL formula to read:
select GroupNumber mod 2
case 0: crWhite
case 1: crYellow
Here is a sample of the report:
Crystal Reporting Tips 4
 

BAASS Technology Insights Blog

BAASS Author

About The Author

BAASS Author

BAASS Business Solutions customer-centric, collaborative approach has enabled us to expand our team and office locations throughout the years. BAASS has over 20 locations throughout Canada, the US and Caribbean. Our success has been built on a simple formula - deliver what we promise and build long-term win-win relationships.