cancel
Showing results for 
Search instead for 
Did you mean: 

Alternating Color Subreport details

Former Member
0 Kudos

I've created a subreport with detail lines that can be suppressed if the value of my database field is zero. So on some reports I could have 7 lines.. and some I could have three (for example) depending on the data. I have to make this table an alternating color table. So if the first line has a white background, the next line needs to have a silver background.. if the line before a line has a silver background.. that line needs to have a while background.

Example of report with 5 detail lines showing:

White

Silver

White

Silver

White

Example with 8 detail lines showing:

White

Silver

White

Silver

White

Silver

White

Silver

There are only 10 detail lines available and the first one is always white. I've been trying to write a formula in the background color properties in my section expert for each detail line that would do this for me.. I was going for something like:

If previous value is crWhite then

formula = crSilver

else

formula = crWhite

end if

I know this is wrong because I can't find a function that will do it for me. Does anyone know a simple way to do this?

Thanks!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Instead of "previous value is crWhite", try "remainder(recordnumber, 2) = 1"

HTH,

Carl

Former Member
0 Kudos

Thank you that worked!!

Former Member
0 Kudos

okay maybe it didn't. All of the lines turned out to be silver except for the first one..

this is what I put in all the detail columns under the background color option:

If remainder(recordnumber, 2) = 1 then
formula = crSilver
else
formula = crWhite
end if

Edited by: MarcieHennessy on Nov 3, 2009 10:07 PM

Former Member
0 Kudos

Is this in a detail format or group header/footer? Is the format conditionally suppressed? These will change the formula. If it's in a group header/footer, use (basic syntax):


global toggleColor as number

toggleColor = 1 - toggleColor

if toggleColor = 0 then
  formula = crSilver
else
  formula = crWhite
end if

If records are conditionally suppressed, use the formula above, but add an IF statement around the toggleColor = toggleColor - 1 line with the condition "NOT (whatever your suppression formula is)".

HTH,

Carl

Answers (0)