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

Top N 4

Status
Not open for further replies.

smeyer56

IS-IT--Management
Oct 16, 2002
206
US
Is there a way to include this in the parameters?

I would like to be able to allow the user to select whether they would like to see the top or bottom x items and not select them while creating the report.

Thank you
 
Are you saying a parameter to choose between Top or Bottom, or are oy saying a parameter to determine the N numberof groups to show?

Software Sales, Training and Support for Macola, Crystal Reports and Goldmine
dgilsdorf@mchsi.com
 
I was saying both but figured out how to determine the N number of groups dynamically. Now I need to find out how to dynamically change from top N to bottom N.

Thanks
 
I figured out how to dynamically choose the top or bottom depending upon a field formula

if {?Top/Bottom} = "Bottom" then {datafield}

what I need is

if {?Top/Bottom} = "Bottom" then Sum ({datafield}, {datafield})

using the first formula I create a report/sort based upon the field formula and sort ascending. I need to do the same for the top to create a descending list but still cannot get it to work with the sum as in the second formula

Any ideas
Thanks
 
Great question. I'll use it for an article in the February Crystal Clear.

A TopN of the -Summary gives you the same result as the Bottom N.

Conditional TopN/Bottom N
1) Create a parameter {?Top/Bottom}
2) Create a formula {@Sort}
If {?Top/Bottom} ="Top" then {table.value}
else -{table.value}
3) Create a subtotal of this in your group and suppress it.
4) use TopN to do a Sort on this subtotal (Ascending)

Conditional number of groups
1)create a parameter {?Group}
2) Do conditional section suppress GH, D and GF of
GroupNumber > {?Group}

Email me (bruce@chelseatech.co.nz) and I'll send the report I used to test this out. Editor and Publisher of Crystal Clear
 
Excellent Question smeyer56 and a superb and simple solution guys. Gary Parker
Systems Support Analyst
 
Got it!
Thanks to all, especially Chelseatech for the excellent tip.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top