Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: How to display top 10 records within date range? Post Reply Post New Topic
Author Message
hari.boyapati
Newbie
Newbie


Joined: 03 May 2010
Location: India
Online Status: Offline
Posts: 4
Quote hari.boyapati Replybullet Topic: How to display top 10 records within date range?
     Posted: 03 May 2010 at 1:30am

I am trying to display top 10 production orders(sorted by defects linked with each order) within the date range selected by the user.Please advice how to develop this report.

  I would like to apply sorting as well as filter together.Please suggest.

Appreciate quick response.

Regards,

Hari 

IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 03 May 2010 at 3:19am
Have you tried looking at help for Top N?
 
I haven't done a report of this kind, but the help, I have found, actually helpful...at least most of the time.
 
HTH
IP IP Logged
hari.boyapati
Newbie
Newbie


Joined: 03 May 2010
Location: India
Online Status: Offline
Posts: 4
Quote hari.boyapati Replybullet Posted: 03 May 2010 at 3:42am
Hi,
  Thanks for the quick response.
 
I  have to apply Top N within the date range selected by the user.
 
So I have apply "group by" clause for sorting the records as well as "BETWEEN AND" clause.
 
It is not always top 5 (or) top 10.It is top N,where N will be entered by the user as one of the parameters.
 
Please advice.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 03 May 2010 at 5:37am
As I mentioned, I haven't used this feature.  If it is too complex, I would write a stored procedure, then you can use the parameter to select the correct Top N...
 
I would think that there would be a way, but I don't know...create a formula or running total to display just the items that you are looking for.
 
HTH
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 03 May 2010 at 6:49am
For a dynamic Top N create a param as numeric. Put any controls you want on it (Min-Max).
In group Sort Expert
Selct TOP N
Where N is - use a formula - make the formula the paramater field
IP IP Logged
hari.boyapati
Newbie
Newbie


Joined: 03 May 2010
Location: India
Online Status: Offline
Posts: 4
Quote hari.boyapati Replybullet Posted: 03 May 2010 at 7:03am
Thanks for the responses.
 
I have one query in this regard:
 
As I need Top N records within the date range picked by the user,how should I frame my stored procedure?
 
Please advice..
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 03 May 2010 at 8:00am
I would have, at a minimum the date start, date end, and topN values as parameters...outside of that I don't know as I don't know anything about the report/data structure.  Depending on your desires, you can filter in the sp or in the report, grouping would probably be in the report, just provide the column in the final select of the sp for CR to use.
 
HTH
IP IP Logged
hari.boyapati
Newbie
Newbie


Joined: 03 May 2010
Location: India
Online Status: Offline
Posts: 4
Quote hari.boyapati Replybullet Posted: 05 May 2010 at 7:16am
I have one question in this regard.
 
Is it possible to send a list of values(array of values with , as delimiter) from main report to subreport?
 
I so far handled only passing a single value from main report to subreport.
 
Please suggest.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 06 May 2010 at 3:07am
While I haven't used arrays much, and I try to avoid subreports, it should be entirely possible to pass an array of delimited values to or from a subreport. You just add 'array' to pass one, like: shared numbervar array x.
 
HTH 
IP IP Logged
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