Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Suppression formula help Post Reply Post New Topic
Author Message
joeld_mn
Newbie
Newbie


Joined: 07 Mar 2008
Online Status: Offline
Posts: 9
Quote joeld_mn Replybullet Topic: Suppression formula help
     Posted: 07 Mar 2008 at 8:46am
Hello, being new to crystal reports I am having trouble figuring out how to suppress data in my report so I am here looking for help.  I am using crystal 10. 
 
My report returns the follow data: Qty Needed and Qty Available in each location.  For one part I might have 4 lines showing the quantity in each location.  For another part only one line because it is only in one location, etc... My Qty Available is sorted by oldest receipt date.
 
I have to use the oldest inventory first.  So I am trying to figure out how to compare the first line Qty Available to the Qty Needed.  If there is enough inventory there then just print that line, suppressing the others.  If not then add Qty Available from line 1 to Qty Available from line 2 and compare that to Qty needed.  If that is enough then print lines 1 and 2. 
 
Thanks in advance,
Joel
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 10 Mar 2008 at 4:29pm
I think this will work...
 
If you're haven't already, set up a group on Part Number (or however you identify your items...it may be item name). 
 
A regular running total sum of the available parts won't necessarily work here because your Qty Needed will probably only part of what's available, so you'll need to use a formula, something like this:
numberVar TotalAvailable;
numberVar CanShow := 0;
 
if previousIsNull({table.part_num}) or
  ({table.part_num} <> previous({table.part_num}) then
    TotalAvailable := 0;
 
if {table.Qty_Needed} < TotalAvailable then
  CanShow := 1
else
  TotalAvailable := TotalAvailable + {table.Qty_Available};
CanShow
 
I'm going to assume that you name the formula "ShowLine".  So, in your suppress formula, put this:
 
 
-Dell
 
 


Edited by hilfy - 10 Mar 2008 at 4:30pm
IP IP Logged
joeld_mn
Newbie
Newbie


Joined: 07 Mar 2008
Online Status: Offline
Posts: 9
Quote joeld_mn Replybullet Posted: 12 Mar 2008 at 2:37pm
Thank you so much.  Big%20smile  I just finished adding it to my report and it worked great.  Not only was I struggling with crystal's syntax and available commands, I was having trouble with the logic needed to solve my problem.  I had 2 strikes against me from the start! 
 
Thanks again,
Joel
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