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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Color formatting issue 1

Status
Not open for further replies.

arodri

Technical User
Jul 9, 2010
121
US
Hello,

I have a report that is being populated by a stored procedure from a sql database. I have two groups, Region and employee name, and all of my data is in the footer of the employee name group. I have a running total named "Cars" and I suppressed any employee that has #Cars=0.

I need the records in my report to be alternating in color. So for example, the first name is white, second is grey, third is white, fourth is grey, etc. I used this formula BEFORE suppressing records with #cars=0 :

if GroupNumber mod 2 = 0 then crSilver else crNoColor

It worked exactly as I wanted it to, but when I suppressed those employees, the coloring got all messed up. I think it's still evaluating the coloring with EVERY records, BEFORE I suppressed, and I need the coloring to be altering with what is showing up on the report. So right now, for example, the first record will be white, and the next 4 in a row will be grey, then two will be while, next 3 grey, etc.

Thanks in advance for any help!
 
Create a formula like this and place it in the employee group footer (that you are coloring):

//{@cnt}:
whileprintingrecords;
numbervar cnt;
if {#Cars} <> 0 then
cnt := cnt + 1;

Then use a formula like this in the section expert->group footer->color->background->x+2:

evaluateafter ({@cnt});
whileprintingrecords;
numbervar cnt;
if remainder(cnt,2) = 0 then
crsilver else
crnocolor

-LB
 
That worked perfectly! Thank you so much :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top