Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Changing Background Colour First Record In Group Post Reply Post New Topic
Author Message
dapoole
Newbie
Newbie


Joined: 29 Sep 2010
Online Status: Offline
Posts: 6
Quote dapoole Replybullet Topic: Changing Background Colour First Record In Group
     Posted: 29 Sep 2010 at 3:33am
Hi,
 
How can I change the background colour of each first record of each group?
 
For example:
 
if recordnumber = 1 then crRed else crSilver
 
This will change the first row colour however I want it to change the first row colour of each group.
 
Thanks in advance.


Edited by dapoole - 29 Sep 2010 at 4:02am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 29 Sep 2010 at 4:01am

in section expert select detail row

select color tab
add formula
If previous({table.groupfield})<>{table.groupfield} Then crColorHere Else crNocolor
 
make sure to flip the option in the formula editor to use "default values for null"


Edited by DBlank - 29 Sep 2010 at 4:02am
IP IP Logged
dapoole
Newbie
Newbie


Joined: 29 Sep 2010
Online Status: Offline
Posts: 6
Quote dapoole Replybullet Posted: 29 Sep 2010 at 4:09am
Originally posted by DBlank

in section expert select detail row

select color tab
add formula
If previous({table.groupfield})<>{table.groupfield} Then crColorHere Else crNocolor
 
make sure to flip the option in the formula editor to use "default values for null"
 
Thanks. That changes the colour of the first record of each group, apart from the first group though?!
 
Edit:
 
Got it. This works:
 
if recordnumber = 1 then crRed else
If previous({table.group})<>{table.group} Then crRed Else crNocolor
 
 
Thanks again.
 


Edited by dapoole - 29 Sep 2010 at 4:16am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 29 Sep 2010 at 4:35am

Glad you found a work around for the first record.

As an FYI - I had posted for you to change the setting in the formula editor to use 'default values for nulls'. Since the previous record of the first record is NULL the formula dies on the first record unless you make the change so that a NULL beomes a value. This would have made the first record function.
IP IP Logged
dapoole
Newbie
Newbie


Joined: 29 Sep 2010
Online Status: Offline
Posts: 6
Quote dapoole Replybullet Posted: 29 Sep 2010 at 4:39am
Originally posted by DBlank

Glad you found a work around for the first record.

As an FYI - I had posted for you to change the setting in the formula editor to use 'default values for nulls'. Since the previous record of the first record is NULL the formula dies on the first record unless you make the change so that a NULL beomes a value. This would have made the first record function.
Thanks. I did have a look for the default values for null option but couldn't find it as I'm actually on version 8 so it maybe hidden elsewhere.
IP IP Logged
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