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

Ranking

Status
Not open for further replies.

diannelight

Technical User
Feb 24, 2003
59
US
Good Morning!
I have a report that shows only the top 50 destinations - how do I format this in Crystal 8.5?
Also, how do I change the font colour of a value when it for eg. is the maximum value?
Thank you for your help.
 
You have a report, or you need a report?

You would use a Top N report in Crystal, depending upon your version.

In the CR report expert, Group by destination and select the field to summarize in the Top N tab to determine the top destinations, then select where N is 50.

-k
 
For the font color change, go to format field->font->color->x+2 and enter:

if {table.field} = maximum({table.field}) then crRed else crNoColor

If the field you want to highlight is a summary in a group header, then after doing a topN sort and assuming a descending order, use the following formula for the font

if groupnumber = 1 then crRed else crNoColor

-LB
 
K,
I am using Crystal 8.5.
Have done as you have suggested and it does bring back the top 50 destinations. However, when I try to create a total, it sums up all destinations & not just those that are the in the top 50.
Please help.
Thanks.
 
Try using a variable to create the sum:

whileprintingrecords;
shared numbervar topNsums;

if groupnumber <= 50 then
topNsums := topNsums + sum({table.amount}, {table.groupfield}) else
topNsums := topNsums;

-LB
 
LB,

Tried this but it still gives me the total for all ranked / unranked group. (ie. it gives the whole total as if I'd not applied TopN=50).
Do you have any other suggestions?
Thanks again.
 
Try this, with 2 formulas:

in the details section:
WhilePrintingRecords;
Numbervar Top5;
if groupnumber<6 then Top5:=Top5+{AmountField}

In the report footer:
WhilePrintingRecords;
Numbervar Top5;

Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
 
dgillz,

Thanks for this - it has helped. The only thing is I have a group within a group so I need the GroupNumber to return to 1 when I start a new group.
Appologies for my ignorance.
Thanks again.
 
To get an accurate total of a TopN report, simply add your total as a running total field under Insert - Field Object (no variables needed).

Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Expert's Guide to Formulas / Tips and Tricks / Guide to Crystal in VB
- tek@kenhamady.com
 
Ken, thank you so much - this really helps & solves all my problems!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top