Crystal Reports & SQL Reporting Services Training Consultants
Account Log in:
Username:
Password:
Be insatiably curious. Ask 'why' a lot
 
Institute of IT Trainers - Freelance Trainer of the Year 2006 & 2009
Liverpool Business Connect Member
  Maximum Impact Solutions Limited - Reporting Solutions, Creating Answers
Reporting Solutions - Creating Answers, Crystal Reports, Dashboarding (Xcelsius) & SQL Reporting Services

The Maximum Impact Solutions Blog Feed ME!!!!

20
February

How Do I Only Display the Last 2 Records of a Group in Crystal Reports 2008?

During a recent training session a delegate asked "How does one only display the last two records for a group?"

Solution:

There are a number of methods one can use to achieve but the easiest way is to use a running total field.

To return the last two records for a group
  1. Create the report
  2. Add a group using the required field
  3. Add the required fields to the Details section
  4. Sort the date-time field in descending order
  5. Create a running total field with the following settings:

    • Field To Summarise:  {Tablename, Date-Time Fieldname}
    • Type of Summary:  Count
    • Evaluate: For Each Record
    • Reset: On Change of Group

  6. Add the Running Total Field to the Details section
  7. Select  the Running Toyal Field and Suppress
  8. From the Report Menu, select the Section Expert Option
  9. In the Section Expert dialog box, select the Details section
  10. Press the Conditional Format button [x+2] for the Suppress No Drilldown option
  11. Add the following formula:

    {#Running Total Field}>2

  12. Press the Save and Close button
  13. Press the OK button



If you have any questions, leave us a comment below, or need any assistance, please do not hesitate to Contact Us
1

Gilbert

01
August
I have a similar situation as describe under " How Do I Only Display the Last 2 Records of a Group in Crystal Reports 2008?" I have a group PCO and sub items under the same PCO. I would like to suppress if I have only one item but print all if I have more than one item.
2

Julia

08
August
Hi Gilbery,

Thank you for your comment.

The way to achieve what you want is to create a Running Total, that accumulates in the Details section, and then use a conditional suppress formula, that suppresses the required section when the Running Total field is less than or equals to 1.

MAKE A COMMENT

Name *

Email Address *

Comment *

To prove you are human what is:

19 + 3 =