BAASS Insights Technology Blog

Crystal Reporting Tips – Alternate Line Shading

Written by BAASS Author | Sep 20, 2019 4:00:00 AM

For 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.

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:
  •  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:

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:
 

BAASS Technology Insights Blog