Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Group by Parameter Nth Top Qty? Post Reply Post New Topic
Author Message
Debbie Giles
Newbie
Newbie
Avatar

Joined: 16 May 2008
Online Status: Offline
Posts: 10
Quote Debbie Giles Replybullet Topic: Group by Parameter Nth Top Qty?
    Posted: 02 Mar 2009 at 1:56am
I am trying to Group by a formula.  I want to be able to select a number eg. 300 to be my top Nth Qty group by.  I cannot figure out the formula I would enter into the Group by formula.  Rgds
Debbie
Debbie Giles
Syspro Consultant
EOH
+27 21 525 7200
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 02 Mar 2009 at 6:42am

I don't know if you can do that as it can not be determined by looking at the data, ie that information is not inherent in the data. If you just want to print the first 300 records of a group, I can see how that would be done, maybe it is just wording issue.

If you wanted the first 300 records in a group, I would create a formula to be run in the details that is just a counter:
shared numbervar iCount := iCount + 1;
""  //hide the number
 
then in the details section expert, I would conditionally suppress the row if iCount >300
 
there would be a last formula to set iCount :=0 in the group header.  If any calculations are to be performed on the data, you would need to add them in the detail formula or perhaps a running total would work, but I don't use them too often so am not an expert on them.
 
Hope this helps
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 02 Mar 2009 at 6:56am
If you are looking for the top groups rather than the top records per group (lockwelle answers this for you) and you want the Top N to be selected at run time:
Create a Parameter as "Top N Selection" as a number and Enter in any Min and Max restrictions you want to apply.
Set up your Group and summary function (count or distinct count or Sum or whatever you are defining this top values on).
Go to the Group Sort Expert (the graph with teh up arrow on it).
"For this group sort" select "Top N".
"Based on" will be your summary value you defined earlier.
"Where N is" use the formula editor and insert: {?Top N Selection}
You can choose how to handle the other items as needed.
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.