Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Background Colour 3

Status
Not open for further replies.

rewob65

Technical User
Nov 13, 2004
110
GB
Hi how can I format a group so that the first line is has a grey background the second a white background and so on, to make the reportm easier to read.
Thanks
 
In the background color expression for the section enter something like:
Code:
IF Remainder(GroupNumber, 2) = 0 THEN CrYellow ELSE CrSilver
Cheers,
- Ido

Visual CUT & DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Yes it works, and answers my question. How can I use custom colours or shades of grey as have a mono printer
 
The color constants are available for you as the 2nd node under the function tree in the expression editor.

Cheers,
- Ido

Visual CUT & DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Fantastic. One final question,If I wanted say threee or more colurs is there any easy way excepted for mulitiple if then functions?
 
Here's a formula for four colors:

if remainder(groupnumber,4) = 0 then crYellow else
if remainder(groupnumber,4) = 1 then crRed else
if remainder(groupnumber,4) = 2 then crBlue else
if remainder(groupnumber,4) = 3 then crPurple else
crNoColor

-LB
 
I would suggest you avoid multiple colors. Alternating between 2 colors (or a color and no color) has a reason - alternating between more than 2 colors falls into the category of "a solution in search of a problem"... :eek:)

In any case, in order to avoid the multiple if statements, I prefer something like:
Code:
Select Remainder(GroupNumber, 4)
Case 0: CrYellow 
Case 1: CrSilver
Case 2: crLime 
Default: crNoColor

Cheers,
- Ido

Visual CUT & DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Rewob65

In regards to your query about shades of grey for a mono printer, I find the RGB color function very useful. Also FWIW, my personal preference is to use the Mod function instead of Remainder.

Code:
if GroupNumber mod 2 = 0 then color(R,G,B) else crNoColor

// where R,G & B are decimal values, e.g.

//color(240,240,240):[COLOR=purple #F0F0F0]  light shade   [/color]
//color(220,220,220):[COLOR=purple #DCDCDC]  medium shade  [/color]
//color(200,200,200):[COLOR=purple #C8C8C8]  darker shade  [/color]

Teddles
 
Thanks for thsoe posts. I am always amazed what I can learn and then expand. i guess it is obvious that I am using shades so people can tell one line from another. what is the minimum change from white a normal person can tell easily, as I want to conserve toner. This isn't really a crystal question so if it is ingnored I understand
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top