databaseconditional-statementsformularecordsuppress

Crystal Reports - Show the first 2 records of each group


I have a number of dated records, sorted by descending date, which are grouped by vehicle. I only want to see the records of the latest two dates on the report.

I'm using this answer from an old question.

https://stackoverflow.com/a/30184315

I'm using Suppress No Drill-Down on the Details section with RecordNumber > 2. This works perfectly for the first group, but the other groups are now all blank. I have a Page Header, Group Header, Details, and Group Footer.

Is there a way to use RecordNumber > 2 for the details under each group? Maybe some reset on change of group?

Image attached

Preview on the records. It's grouped by Fleet no, non-bold are the Details section


Solution

  • Step 1: Create a Running Total called G1_Counter on the Date Field.

    Type of summary: Count

    Evaluate: 'For each record'

    Reset: 'On change of Group'

    Step 2: Set the detail section suppress condition to:

    {#G1_Counter} > 2