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!

Crystal TopN Formula Problem

Status
Not open for further replies.

Pablo360

MIS
Dec 5, 2013
5
US
I found a closed thread that appears to do just what I want to do but I get an error when I try to implement the formula. lbass offered the solution.

The closed thread is:

thread767-1644229

My error message when I put in the group selection formula is "The result of the selection formula must be a bolean."

I am using Crystal 11 with an Access DB.
Here is the group selection fomula.

whileprintingrecords;
numbervar dcnt;
numbervar cnt := cnt + 1;
numbervar curr;
numbervar prev := curr;
curr := Count ({table.visits}, {table.name});
if groupnumber = 1 or
curr <> prev then
dcnt := dcnt + 1 else
dcnt := dcnt;
 
The formula you are using is not meant to be in the Group Selection formula.
It is meant to be a stand alone formula that is displayed in the Group Footer.
It will show the ranking of the group.

The text below will be used in the Section Expert for the Group Footer:
Code:
whileprintingrecords;
numbervar dcnt;
numbervar cnt;
numbervar lastdcnt;
if cnt = {?N} then
lastdcnt := dcnt;
cnt > {?N}  and
dcnt > lastdcnt;


Bob Suruncle
 
Thank you Bob! You can tell I'm pretty shallow on my knowledge but your input did the trick!
 
I thought all was well with the solution that Bob proposed above. However, if the first N fields are all the same rank then it picks up the next field as well. IE, if N = 3 and the scores are:

6.0
6.0
6.0
5.8
5.8

It should pick up only the 6.0 as the top 3. Instead it picks up all 5 scores.

Anyone see a flaw in the logic?

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top