Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Only display X# of records by field name Post Reply Post New Topic
Author Message
mburris
Newbie
Newbie


Joined: 20 Dec 2009
Online Status: Offline
Posts: 4
Quote mburris Replybullet Topic: Only display X# of records by field name
     Posted: 20 Dec 2009 at 3:40pm
Its hard for me to even know how to phrase this question, so I will use an example...

Here is my database table (my database is a single table, with a column for Date/Time, food, Drink, and Person):
Date/Time___________Food____Drink___Person
12/20/2009 1:00pm     Apple___Coke____Dan
12/20/2009 1:30pm     Orange__Pepsi___Pat
12/20/2009 2:00pm     Pear____Milk____Dan
12/20/2009 2:15pm     Bannan__Water___Sue
12/20/2009 3:00pm     Cookie__Pepsi___Dan
12/20/2009 4:00pm     Cerial__MTN_____Pat
12/20/2009 4:21pm     Steak___Pepsi___Dan
12/20/2009 5:00pm     Burger__Vodka___Sue
12/21/2009 1:00pm     Chicken_Sprite__Sue
12/22/2009 1:00pm     Ham_____Wine____Pat

I would like to do a parameter popup that allows the end user to choose the maximum results to be displayed for each Persons name...

So if there are 4 database entries that have "Dan" listed in the "person" column, and the end user Specifies "2" as the "Maximum per person" parameter, I'd like the report to hide all but the last 2 results for each person. So after the filter was applied, the same report as above would look like this:

Date/Time___________Food____Drink___Person
12/20/2009 3:00pm     Cookie__Pepsi___Dan
12/20/2009 4:00pm     Cerial__MTN_____Pat
12/20/2009 4:21pm     Steak___Pepsi___Dan
12/20/2009 5:00pm     Burger__Vodka___Sue
12/21/2009 1:00pm     Chicken_Sprite__Sue
12/22/2009 1:00pm     Ham_____Wine____Pat

I am already using parameters that let the end user specify the date range, and the ability to select all or specific "persons" to only show in the report... but I just cant figure out this part.

any help would be greatly appreciated.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 20 Dec 2009 at 7:16pm
I would create a Running Total using the two paramters then conditionally suppress the rows using that RT.
RT Called: Suppress
Field to summarize= Person
Type=COunt
Evaluate=use a formula person={?Person param}
Reset=Never
 
On your details section conditionally suppress as:
{#Suppress}>={?Number Param}
IP IP Logged
mburris
Newbie
Newbie


Joined: 20 Dec 2009
Online Status: Offline
Posts: 4
Quote mburris Replybullet Posted: 20 Dec 2009 at 7:21pm
Please see this thread... now I'm using groups... should be much easiler:

http://www.crystalreportsbook.com/Forum/forum_posts.asp?TID=8697&PID=27618#27618
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