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!

Penultimate Record 1

Status
Not open for further replies.

gsmithmme

Technical User
Jun 3, 2004
51
US
Using Crystal 8.5 on a Paradox database, I need to select only the penultimate record of a selection of data. So, if there are 10 records total, I need to display only record #9. If there were 3 records, then I need to display only record #2. BUT, if there is only one record, then display some message like "First Maintenance"

I have searched, and I have chosen last records before (using Maximum), but never a "Next to last record".. Anyone have a suggestion?
 
You can use a suppression formula like this on the detail section:

whileprintingrecords;
numbervar cnt := cnt + 1;
if count({table.field}) = 1 then
false else
cnt <> count({table.field})-1

This assumes you are aren't doing this within a group.If within a group, you would have to add a reset formula in the group header for the cnt variable, and add a group condition to the counts.

-LB
 
Brilliant! I imagine you will have forgotten more than I will ever know. Thank you so much.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top