Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Changing colour horizontally Post Reply Post New Topic
Page  of 2 Next >>
Author Message
Goldberg
Groupie
Groupie
Avatar

Joined: 15 Apr 2011
Location: Portugal
Online Status: Offline
Posts: 58
Quote Goldberg Replybullet Topic: Changing colour horizontally
     Posted: 14 Dec 2011 at 4:49am
Hello,

I'm using a cross-tab in order to list school classes marks'.

It is ordered in the following way:

                           Subject
Name of student     Mark

Since there are a lot of students and subjects, it makes it harder to differenciate what mark belongs to what student.

My question is:

Is it possible to, dinamically, change the colors horizontally? Like one line is white, the other is grey, then white, then grey...

Thanks
IP IP Logged
kostya1122
Senior Member
Senior Member
Avatar

Joined: 13 Jun 2011
Online Status: Offline
Posts: 475
Quote kostya1122 Replybullet Posted: 14 Dec 2011 at 5:39am
try going to template expert and see if you find what you need or try
conditional coloring
if Name of student   =  "Mar" then crgreen....
IP IP Logged
Goldberg
Groupie
Groupie
Avatar

Joined: 15 Apr 2011
Location: Portugal
Online Status: Offline
Posts: 58
Quote Goldberg Replybullet Posted: 14 Dec 2011 at 6:16am
the Mark reports to the subject mark, not a student name.
The cross tab goes like:
            French      English
John         A              B-
Anna        C              A-
Matt         A              A-

and I want the 1st row to have white background, second row grey background, then white, then grey...
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 14 Dec 2011 at 8:27am
you can use a counter that increments with each row, something simple like:
shared numbervar x;
x := (x + 1) mod 2;
""  //will hide the alternating 1 0
 
then in Section Expert for the detail section go to the color tab and select the background color and then click the x-2 button.  The default color names are spelled out, but the formula would be something like this:
 
shared numbervar x;
 
if x= 1 then
  crWhite
else
  color(240.240,240);  //or you could use crGrey or crSilver, but I think that they are too dark.
 
you might want to put a reset formula on the page header or group header like:
shared numbervar x:=0;
"" //hides the reset.
 
HTH
IP IP Logged
Goldberg
Groupie
Groupie
Avatar

Joined: 15 Apr 2011
Location: Portugal
Online Status: Offline
Posts: 58
Quote Goldberg Replybullet Posted: 14 Dec 2011 at 11:30pm
I'm using a cross-tab, therefore I cannot use that formula on the detail section, seeing the cross-tab can only be placed in the report header or footer.

How should I proceed?

Thanks
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 15 Dec 2011 at 3:10am
alas, same difference:
to ensure repeatability, create another footer(or header) section and place the increment formula there.  Then all is as before.
 
Or, thinking about it for a moment more, why not incorporate the increment and the color selection...
 
shared numbervar x := (x + 1) mod 2;
if x = 1 then
  crWhite
else
  crSilver;
 
 
if you want the pages to look the same, have a reset in the page header.
 
HTH
IP IP Logged
Goldberg
Groupie
Groupie
Avatar

Joined: 15 Apr 2011
Location: Portugal
Online Status: Offline
Posts: 58
Quote Goldberg Replybullet Posted: 15 Dec 2011 at 6:01am
But if I do that on bg color of the report footer (where I have the crosstab), it will make the whole tab the same color
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 15 Dec 2011 at 6:49am
ok,
looking at the reports that I did, and I don't know if this will work for you as I don't use cross tabs...
 
I have a text box that is grey in the background (all of my controls are on top of it) and I selectively suppress it so as to give the appearance of the the alternating lines.
 
The idea is still the same, have a number that increments, take mod 2 of it so that it is 1 or 0, and then use that to switch the color on, or to hide/show an object.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 15 Dec 2011 at 7:09am
still the same issue as the mod option as the CT resides in only one section...
I use the same processes as lockwelle outside of a crosstab for alternating row colors.
I would assume there is some function in a CT that is a "row counter" that you could use the same idea as the "mod 2" to alternate the color on but I don't know what that object or row trait name is (and I am only assuming that one exists).
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 15 Dec 2011 at 11:07am
hmmm....
how interesting.
 
yeah, doesn't seem to be any method exposed.
 
sorry, well, like I said, I don't use cross tabs much.
 
you would think that they would have something for alternating lines
IP IP Logged
Page  of 2 Next >>
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