Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Report Design
Message Icon Topic: Limit Subreport to 5 results? Newb using V 8.5 Post Reply Post New Topic
Author Message
LNZPTI
Newbie
Newbie


Joined: 06 Jan 2010
Online Status: Offline
Posts: 2
Quote LNZPTI Replybullet Topic: Limit Subreport to 5 results? Newb using V 8.5
    Posted: 06 Jan 2010 at 5:56pm
First off, I'm a total newb to crystal but was asked by the owner of my company to edit a report because I "know a lot about computers". We're still running version 8.5 and I was handed a book for version 7 and told to figure it out.

My company keeps records of every quote a salesman gives on an item in our inventory. I have a report created that I run daily for sales meetings that shows every inventory item quoted that day, and then a subreport that lists the entire quote history for that item. What I need it to do is display the results of the quote history subreport to whatever the last five quotes for that item were and then suppress the rest of the results. I need it to go back through our entire history, so limiting by date or anything like that doesn't really help me.

Is anyone feeling generous enough to point me in the right direction? I'm feeling pretty frustrated at the moment. Thanks.
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet Posted: 07 Jan 2010 at 10:34am
I don't remember if 8.5 had "Running Totals" and I don't have a copy of it I can look at.  So here's two different ways of doing this:
 
If 8.5 does have Running Total, create one that will count the number of records - I'll call it {#RecCount}.  Then, in the Section Expert (right-click on the gray area to the left of the sections and it should be an option on the menu) DO NOT check the Suppress check box but click on the button to the right of Suppress.  Enter the following:  {#RecCount} > 5.
 
If it does not have running totals, you'll need to use a variable and a formula.  I'll call the formula {@RecCount} and it will look like this:
 
NumberVar RecCount;
If PreviousIsNull({table.some identifying field}) then RecCount := 1
else RecCount := RecCount + 1;
RecCount
 
Note where the semi-colons are and that there is NOT one on the last line!  Also, you may have to put WhilePrintingRecords; as the first line in the formula to get it to work.  Then you'll do the same thing in the suppression formula as I outlined above:  {@RecCount} > 5.
 
-Dell
IP IP Logged
LNZPTI
Newbie
Newbie


Joined: 06 Jan 2010
Online Status: Offline
Posts: 2
Quote LNZPTI Replybullet Posted: 07 Jan 2010 at 4:50pm
Fortunately, 8.5 does have the "running totals" option. This worked perfectly. Thank you so much!!!
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.078 seconds.