Link to home
Start Free TrialLog in
Avatar of Jimmy2010
Jimmy2010

asked on

How do I highlight first and last row in Crystal Reports

I have a Crystal Report version 9 and in my details line I can have numerous rows - each row contains a start amount and an end amount.
I want to highlight the start amount on the first row of the details section and also highlight the end amount on the last row of details.
i.e. 10      20            30          40  
      20      25            35          45
      30      35            40          50
I want to highlight the first 10 and the final 50.

Thank you
Avatar of Mike McCracken
Mike McCracken

Try this

Right click the start amount field
Click FORMAT FIELD
Click the BORDER TAB
Click the formula button to the right of BACKGROUND
Add a formula like

If OnFirstRecord then
   crblue
Else
   crWhite

Similarly for the last field
If OnLastRecord then
   crblue
Else
   crWhite

mlmcc
Alternatively, you can right click on Details section ->Section Expert->go to Color tab-> right the above mentioned condition (by mlmcc) or you can write something like

if onfirstrecord or onlastrecord then
gray
else
white
Avatar of Jimmy2010

ASKER

Thank you - that worked fine and the first and last line of the report have been highlighted.
My next question is if the data is sorted by group how do I highlight the first and last row of each group? e,g,
Group Header 1 = Type 1
Details 10      20            30          40  
            20      25            35          45
            30      35            40          50
Group Header 1 = Type 2
Details 10      20            30          40  
            20      25            35          45
            30      35            40          50
I want to highlight the first and last row of each group? I have tried to do the same for the Group Header color formula but it still only did the first and last on the report.
ASKER CERTIFIED SOLUTION
Avatar of msd1305
msd1305
Flag of United Arab Emirates image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This is a link incase you need any help to create summary field. http://www.dotnetspider.com/resources/30947-Add-Group-Count-Crystal-Report-Using-Summary.aspx
Worked perfectly - thank you