INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

How to alternate background color on every other line

How to alternate background color on every other line

(OP)
I need to format some reports that have long lists of information and it would make them alot easier to read if I could format the background color to alternate everyother line like in templates.  What would a sample formula for this look like?

RE: How to alternate background color on every other line

5
In the color attribute of the section format options enter something like:
-----------------------------------------------------
IF Remainder (RecordNumber, 2) = 0 THEN crYellow ELSE crNoColor
-----------------------------------------------------

Cheers,
- Ido

CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
www.MilletSoftware.com

RE: How to alternate background color on every other line

(OP)
That worked great but now how would I make the font be a different color on the lines that are yellow.  I modified the formula so that I was using crTeal and it's hard to read black text on that background.  Unless there is a way for me to specify the hex equiv for a lighter shade or am I stuck with just color names like Blue, Red, Yellow?

Thanks

RE: How to alternate background color on every other line

4
You can use Color() and supply the RGB values, like this:

IF Remainder (RecordNumber, 2) = 0 THEN Color (238, 238, 224)
ELSE crNoColor


-dave

RE: How to alternate background color on every other line

All of the named Colors will be in the function panel under the Color Constants.

Teal is one of the named colors.  

IF Remainder (RecordNumber, 2) = 0 then teal else defaultattribute  



Mike   

RE: How to alternate background color on every other line

Thanks fellas this used to be in a FAQ somewhere but it's disappeared.  Very Handy

RE: How to alternate background color on every other line

Also. If your getting multiple returns for each record and want every group to alternate colors is there a way to do that?

RE: How to alternate background color on every other line

Answered my own question.  Use GroupNumber instead of RecordNumber in 9.0

RE: How to alternate background color on every other line

slightly different way, but just swap RecordNumber for GroupNumber

if GroupNumber mod 2 = 0 then
    color (232,232,232)
else
    white

Gary Parker
Systems Support Analyst
Manchester, England

RE: How to alternate background color on every other line

2
Dear NovellCRDeveloper,

Here is a tip I show in my classes:

If you have suppressed groups or details, then using groupnumber or recordnumber will not work.

Create a running total (Insert Field Object/Running Total) and choose the Group or Detail field as the case may be.  Select Count, Evaluate on Change of Record, Reset Never.

Now you have a counter field that counts the "visible" records and you would use that in the formula.

Now, to get the rgb value for any color, simply select format/font on any field, go all the way down the list to custom and then in the Custom Color Dialog select any color you want - the rgb value will display for you to note.

I find that a very light gray works really well.

Also, by changing the divisor to another number you can change the banding.

I hope the above was helpful,

ro

Rosemary Lieberman
rosemary@microflo.com, www.microflo.com
Microflo provides expert consulting on MagicTSD and Crystal Reports.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close