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

Crystal Rep10: Sort & display top/bottom N groups programmatically

Status
Not open for further replies.

bether

Programmer
Jan 3, 2007
28
US
Is it possible to do the sorting of groups and get the top N groups (with the highest/lowest summary), programmatically? The top N number will be a parameter, and so is the order (ascending/descending). I've been trying but have not been successful.

Thanks!
 
From your question I will assume you are not using Crystal XI as this is possible in this version - you can put a parameter (prompt) in the TopN Sort Expert.

In previous versions - to show the Top or Bottom anything dynamically - you need to come up with a formula that will suppress the unwanted groups - there is a keyword in Crystal called "GroupNumber" - so if you sort the report from highest to lowest - and in the Section Expert set the formula for suppress to GroupNumber > {?Parameter}.

If Parameter = 10 then when group 11 comes it will be suppressed. Bottom N is the reverse.

To change the sort order - you would need the report sorted two ways - and place them both in a "shell report" containing nothing but parameters. Supress the subreport you don't want to see.

The other ways you can accomplish this is via stored procedures - where the database does all the work and sends the records in the correct order to Crystal which merely displays them.

I hope this helps

Cheers
paulmarr

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top