Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Show most recent five records

Status
Not open for further replies.

Davest11

Programmer
Oct 26, 2004
82
US
I have what I think is a fairly simple question, but I can't figure a way to do it. I'm using Crystal v10 SP4 on a Progress database. What I need is to show only the most recent five records, by date. The significant fields in the table are <CntctDate>, <CntctText>, and <CntctNum> (a unique identifier). There may be multiple records on a given date, so I don't see a way to group and using the Top N. Grouping and taking the Top N by the <CntctNum> won't work either, as the highest <CntctNum> won't always have the most recent <CntctDate>.

I considered creating a variable, incrementing it, and suppressing when the variable reaches 5, but this is a long report with many subreports, and I'm hoping that there's a more efficient way. I suspect that there's an automated way to simply display a particular number of records without grouping, but I can't find it.

Thanks,

-Dave
 
Can't you simply sort by date and then create a running total counting each record and then supressing the section where RunningTotalField>5

jcl5
 
Yes, that's probably what I'll end up doing. I was just hoping that there was a way to do it without bringing all the records down from the server and then suppressing them. This is one of about 15 sub-reports in this report, and it takes quite a while to run. Where I only need to see five out of several thousand records, a way to select only the five I want at the server level would save valuable seconds at runtime.

-Dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top