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!

Sorting on Running Totals 1

Status
Not open for further replies.

prevost999

Programmer
Jun 28, 2001
38
US
How do you sort on a running total in CR8?

* I can't create a Summary Field and use Top N functionality, because the running total is based on
a formula which only totals certain records.
* From what I have read, the only way to do this is to
incorporate the running total in the SQL query in a
stored procedure.

Is this assumption accurate? Is there something I'm
missing? Thanks in advance.
 
You can't sort on a running total because it happens "whilePrinting" which is after the sorting/grouping is done.

You CAN use TopN with summaries based on conditinal fields, as long as the conditions don't rely on summaries or certain other functions. Post the condition formula that your running totals are based on and I will see if there is another way to write it so that you can use TopN. Ken Hamady, On-site/Phone Crystal Reports Training/Consulting
Quick Reference Guide to using Crystal in VB
 
kenhamady:
Here is the formula the running total is based on:

{ttdpur045001.t_date} >= (CurrentDate - 365) and
{ttdpur045001.t_date} <= CurrentDate

Thanks for your help.

 
This doesn't need a running total. This could be a regular total:

Create a formula field using your formula:

if {ttdpur045001.t_date} >= (CurrentDate - 365) and {ttdpur045001.t_date} <= CurrentDate
then 1 else 0
//use::
// then {table.amount} else 0
//if you are summing a numeric

Now sum this formula to get your count or sum.

Then use TopN with this summary field. Ken Hamady, On-site/Phone Crystal Reports Training/Consulting
Quick Reference Guide to using Crystal in VB
 
kenhamady:
It worked! Thank you very much!!! Your help is
invaluable!
 
I'm trying to sort records by a calculated Percentage which is done on the report.. Any ideas on how to accomplish this kind of sort? The sort record funtion only is allowing summary fields, database fields and the groupings that I have in the report. Since it is a calculation done on the report, N-sort looks like it won't work either..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top