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!

Dynamic Sorting ? 1

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I have a report that groups on a field called page. I also have a count of the number of records for the field page and an average processing time for the field page. I am looking for a way to sort the report dynamically by number of records or by average time processed based on user input. I have tried formulas, etc. with no luck. Can this be done?

TIA

jbbrew
 
Create summary fields for your Count or Average (not formulas) and then you can use the TopN feature to rank your groups based on their sum or average. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Ken,

Thanks for the response. I've tried this and it still doesn't do exactly what I want. I want to allow the user to select a parameter that will indicate which field (count or average) to sort by at runtime. I have both summary fields in the TopN feature, but it always takes the first entry and ignores my parameter. Any other ideas?

Thanks

jbbrew
 
You can't change summary field's operation based on a paramter, but you can change a group field using a formula. So you will need to create two group using formula fields as the groups. TopN each group, one on the SUM and the other on the AVERAGE.

The formulas should be IF-THEN formulas that are set up so that one formula returns the group field and the other returns a constant value (and vice versa), based on the parameter choice. You then suppress GH and GF for whichever group is the constant, and it looks like you have one group switching back and forth. What you really are seeing is one of two group levels. Since one level is always a constant value, its TopN doesn't affect the order of the groups.

I call this "group cloaking" and it is used whenever you need a group level to disappear. 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