How do I highlight first and last row in Crystal Reports

Jimmy2010
Jimmy2010 used Ask the Experts™
on
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
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Mike McCrackenSenior Consultant
Most Valuable Expert 2011
Top Expert 2013

Commented:
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

Commented:
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

Author

Commented:
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.
OWASP Proactive Controls

Learn the most important control and control categories that every architect and developer should include in their projects.

Commented:
You have to create 2 fields to achieve this.
1) Create a running total field "reccount" to count records in the group  (reset on change of group).
2) Create a summry field to count number of records in the group. (right click in details section->insert summary->count(fieldname)    "myGroupCount")

Now, you can right click on Details section ->Section Expert->go to Color tab and specify the condition

if #reccount =1 or  #reccount =#myGroupCount then
gray
else
white

Commented:
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

Author

Commented:
Worked perfectly - thank you

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial