Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Alternate group row color with multiple groups Post Reply Post New Topic
Page  of 2 Next >>
Author Message
elie234
Groupie
Groupie


Joined: 21 Aug 2009
Online Status: Offline
Posts: 68
Quote elie234 Replybullet Topic: Alternate group row color with multiple groups
    Posted: 24 Sep 2009 at 2:11pm
I have a report with multiple groups where I would like to alternate row color in the group footer. I have seen the tip where one makes a running count of the groupnumber and then evens have color and odds don't. But that doesn't work in this instance since there are mupltiple groups and I only want to alternate colors for the footers of 2 of the 6 groups. In this case want to alternate colors for group footers 6 and 5 (i.e. 6 and 5 together would have no color and then the next 6 and 5 would be silver etc.) How could I alternate in this case?
IP IP Logged
Jyothi Yepuri
Senior Member
Senior Member


Joined: 11 May 2009
Location: Australia
Online Status: Offline
Posts: 127
Quote Jyothi Yepuri Replybullet Posted: 24 Sep 2009 at 4:39pm
Try this in selection expert color condition for GF5,GF6 ..no need for Running total

IF Remainder(GroupNumber,2) =0 then
crSilver
else
crNoColor

HTH,
Jyothi
IP IP Logged
elie234
Groupie
Groupie


Joined: 21 Aug 2009
Online Status: Offline
Posts: 68
Quote elie234 Replybullet Posted: 25 Sep 2009 at 7:06am
Thanks Jyothi, but that doesn't work in this case (I think it is basically the same idea as the running total). It calculates group numbers for all of the groups in the report but since I am surpressing some groups the calculation doesn't work to alternate on just groups 6 and 5 which are the displayed groups.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 25 Sep 2009 at 10:13am
Use a variable or RT that excludes the suppressed items and only "counts" shown items then replace the groupnumber with that option.
likely your suppression criteria can be reused in the selection criteria (evaluate as a formula) in a RT.


Edited by DBlank - 25 Sep 2009 at 10:14am
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 25 Sep 2009 at 10:55am
I agree with DBlank, I would use a variable and only increment it when it is appropriate.  In your case I believe I would increment it in GF6, but if you have multiple GF6 inside of GF5...OK, if you want GF5 and 6 to match, I would increment the variable in GH5, this way, ALL GF6 and GF5 will be the same for a GF5.  Then the changing of the color is easy.
 
HTH
IP IP Logged
elie234
Groupie
Groupie


Joined: 21 Aug 2009
Online Status: Offline
Posts: 68
Quote elie234 Replybullet Posted: 25 Sep 2009 at 11:03am
Is there a syntax to increment on the appearance of a specific group, like to do a count for each appearance of GH5?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 25 Sep 2009 at 11:07am
Not that I am aware of but you can accomplish the same thing via a variable (lockwelles preference) or a Running Total (my preference).
Likely you can use the same RT or variable for this need and you will not need to create 2 of them.
If you need help with that please post your grouping set up and conditional suppression requirements.
IP IP Logged
elie234
Groupie
Groupie


Joined: 21 Aug 2009
Online Status: Offline
Posts: 68
Quote elie234 Replybullet Posted: 25 Sep 2009 at 11:21am
Thank you. There are 6 groups. There is just straight suppression not conditional. Group headers 2 and 3 are shown, rest are suppressed. Group footers 6,5,3,2 shown, 4,1 suppressed.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 25 Sep 2009 at 11:41am
So when you applied Jyothi's approach you did not get what you wanted because synching on the 5-6 grouping even though there is a 1:1 relationship between them ? So the question is what is the group level that keeps it synched for your coloring issue? Once you identify that you use. It is likely whatever the field that you are using for group 5.
Try and create a RT field as...
Name:BackGroundColor
Field to Summarize: group 5 field
Type of summary: Count
Evaluate= on change of field (select field used for group 5)
Reset = Never
Place this RT on your GF5 and and again of GF6 and see if it is giving you what you want in terms of even/odd. If so use it in place of the GroupNumber in J's original formula.
 
If Remainder(#BackGroundColor,2) =0 then
crSilver
else
crNoColor
 
Does that work?


Edited by DBlank - 25 Sep 2009 at 11:43am
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 25 Sep 2009 at 12:00pm
Variables, definitely my preference.  Just in case DBlank's solution doesn't work for you (it probably will) here is what I would do.
1) create formula call it increment:
shared numbervar iCount := iCount +1;
""  //hides the counting on the report
2) place it in GH5
3) goto Section Expert, GF5, Color
  a) check the Background color box
  b) click x-2 and type:
    shared numbervar iCount;
    if iCount mod 2 = 0 then //same as remainder()
      crSilver
    else
      crNoColor
 
Repeat for GF6
 
Hopefully one of else has a solution for you.
IP IP Logged
Page  of 2 Next >>
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.