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!

pre-set number of records

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Currently I pull information in from a sequal server 2000 database and it brings in all records for each individual customer. i want to only bring in the first 20 records for each person. How do I cut off the rest of the informatin in the details section of a sub-report and bring in only the first 20 records that I want for each person... kind of like what the keyword select top 20 ... does in SQL.

Thanks,

eh007
 
Use SQL Query in your crystal report that contain SQL like 'Top 20'.
 
Under the Report menu, there's a Top N/Sort Group Expert option, but you can only use it if your report contains a summary operation (Count, Sum, Average...)
 
I have tried the Top N/Sort Group option, but no luck for 2 hours now. I know I can go into SQL and create a cursor for the top 20, but I was trying to save time and do it through Crystal Reports. I as hoping there was an easier way to handle that. Thanks anyway.

EH
 
Eh-

Top N is not the answer. Top N (as kkashwani said) must have a summary operation to work. Therefore, the ENTIRE datbase must be read first.

You can DISPLAY only the first 20 recrods by putting a running total count field in your details section and conditionally formatting the section to suppress if count>20, however, CR still reads the ENTIRE database when doing this.

I am no programmer but I think SQL is the answer. Please post you r solution when you get one. Software Support for Sage Mas90, Macola, Crystal Reports, Goldmine and MS Office
 
It is a cases of "pay me now or pay me later". If you use SQL, it may take you couple of hours to code it. If you make Crystal do it then you will be wasting time every time that the report runs by reading the entire database instead of just a few records. In the long run, the Crystal soution will use up much more time.
 
CR can't generate SQL that only RETURNS the first 20 records. You can return all records and have CR only display the first 20, but you are returning all of them. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top