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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Return only first 10 records of a group

Status
Not open for further replies.

stussy

MIS
May 22, 2003
269
GB
Hi

I have a report with various groups, and varying numbers of detail lines within each group, from 1's to 1000's. I want to show each group, but only the first 10 lines of any given group - can I do this with the record count somehow?

Cheers

Mike
 
Insert the following formulas in the sections as defined.

GROUP HEADER

Name : {@SetRecordCountZero}
Formula : WhilePrintingRecords;
numberVar RecordCount := 0;

DETAIL

Name : {@AddRecordCount}
Formula : WhilePrintingRecords;
numberVar RecordCount;
RecordCount:= RecordCount + 1;

GROUP FOOTER
Name : {@DisplayRecordCount}
Formula : WhilePrintingRecords;
numberVar RecordCount := RecordCount;

Then supress the Group Footer, and use the Section Expert to conditionaly supress the Detail section where -

{@AddRecordCount} > 10

Hope it Helps...
 
Creating a manual running total is one solution as explained by MJRBIM.

You might prefer to create a running total from the running total menu option.

Create one to count each record and reset on change of group. Then conditionally supress the detail section to supress if the running total is over 10.


Steve Phillips, Crystal Consultant
 
You may be able to limit the rows being pulled from the database, but this would be Crystal version and database dependent, which you didn't share.

The above solutions will work, they're just not as efficient, and if you have groups with 1000's of rows each, it should make a big difference.

-k
 
Cheers for the replies, will try them today.

SV - I'm running CR9, off a c/side (Navision) database accessed thru odbc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top