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

Rec selection formatting

Status
Not open for further replies.

savok

Technical User
Jan 11, 2001
303
AT
I need to show only the top 3 records based on sales.

the 3 rows with the most money :)

So if I have 1$ 2$ 10$ and 50$ in the sales field.

I only want to see 2 10 and 50.

How would I do that?

thanks
 
If you are using SQL Server one way would be like so:

select top 3 freight, orderid, customerid from orders order by freight desc

(this uses the northwind database if you want to run it)

The syntax for Access should be something close.

Oliver
 
Sort the records in descending order based on the amount. Then suppress the detail band with the following condition:

RecordNumber > 3 Ken Hamady
On-site custom Crystal Reports Training and Consulting.
Quick Reference Guide to using Crystal in VB.
 
thanks Ken, that works, but i forgot to mention that I have groups. So I have 5 groups, and in each I need to see only the top 3.

I tried putting RecordNumber > 3 in the group suppress but that didnt work.
 
anyone? :)

Need to see only the top 3 rows in my groups.


RecordNumber > 3 only works if there are no groups.

thanks
 
savok,

See thread 181-27567

I believe the 2nd post is want you want. Just change 5 to 3
 
thanks james, only how do i find thread 181-27567?


 
Add a running total that counts records and resets with each group. Then use the condition:

{#runtot} > 3 Ken Hamady
On-site custom Crystal Reports Training and Consulting.
Quick Reference Guide to using Crystal in VB.
 
Hi,

I have done the same thing in my report
I've addes a running total that counts records with each group. Then in the supress of my detail section I added the condition {#runtot} > 3.
Ok, I get only 3 records in my detail, but the problem is that in the first block of my report the sort condition isn't executed, the next ones are fine. Can somebody give me a hint ?

Thx
 
Was the sort correct before you added the condition? Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Yes, the sort executes correct for all records without the condition in the detail section. With the condition in the detail section the sort is only incorrect for the first block of records in the detail section.
Any clue why ?

Thx

 
That is a weird one, something may be set wrong. Could you post:
Your actual group and sort field names?
Your reset setting for the running total?
Your actual suppress condition formula? Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Why not use a summary instead of a running total, and use the TopN feature? If it s condtional total then use a formula and sumamrise that.

Reports/TopN Sort Group Expert on the menu Editor and Publisher of Crystal Clear
 
Hey, I've created my report again and it seems to work now

Thanks all for your help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top