Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Suppress Based on Criteria Help Post Reply Post New Topic
Author Message
DaBoujibo
Newbie
Newbie


Joined: 21 Feb 2012
Online Status: Offline
Posts: 28
Quote DaBoujibo Replybullet Topic: Suppress Based on Criteria Help
     Posted: 14 Mar 2012 at 8:05am

Hi.  I apologize if this topic has come up before.  I tried searching through the forum for a similar situation but could not find one.

 
I am creating an exception report and need to suppress records based on the following pseudocode criteria as they are not really exceptions as one transaction can cancel the other transaction out.  However, it is possible to have 1 transaction without the other, which would be an exception and needs to appear.
 
Below is the pseudocode for what I need to happen. 
 
If the "Description" field is "XXX" then I need variable A to populate with the value from field 'Amount'.
 
If the "Description" field is "YYY" then I need variable B to populate with the value from field 'Amount'.
 
Then if the value of variable A + the value of variable B = 0 for the entire account, then I need the records to suppress.
 
The problem I have is that there are separate records for variable A and variable B for the same account.
 
SAMPLE TABLE BELOW:
"Account" "Record" "Amount" "Description"
"ABC123" "001"  "123.45" "XXX"
"ABC123" "002"  "-123.45" "YYY"
"ABC123" "003"  "123.45" "XXX"
"ABC123" "004"  "-123.45" "YYY"
 
I have been searching the web for an answer and trying to write custom functions to solve this without any success.  Confused
 
Can anyone help point me in the right direction?  Thank you for your help!  Have a great day! Smile


Edited by DaBoujibo - 14 Mar 2012 at 8:06am
IP IP Logged
kostya1122
Senior Member
Senior Member
Avatar

Joined: 13 Jun 2011
Online Status: Offline
Posts: 475
Quote kostya1122 Replybullet Posted: 14 Mar 2012 at 9:47am
try this
group on Account
then create 2 formulas like
xxx_emount
if Description = "XXX" then "Amount"
yyy_emount
if Description = "YYY" then "Amount"

then create a suppression formula like
suppress
if  sum(xxx_emount,Account) + sum(yyy_emount,Account) = 0 then false
else true

go to your select expert  and place this 
suppress = true
IP IP Logged
DaBoujibo
Newbie
Newbie


Joined: 21 Feb 2012
Online Status: Offline
Posts: 28
Quote DaBoujibo Replybullet Posted: 14 Mar 2012 at 10:40am
Thank you.  However, I receive an error when I try to add to the Select Expert: "This formula cannot be used because it must be evaluated later."  My report was already grouped by Account, so I just added the formulas as instructed.  Where did I go wrong?
 
Thanks again!  Have a wonderful day!
 
Formulas:
 
***TestFormula1***
IF {TABLE.DESC}= "UAP"
THEN {TABLE.AMT}
 
***TestFormula2***
IF {TABLE.DESC}= "EUC"
THEN {TABLE.AMT}
 
***SuppressionFormula***
THEN FALSE
THEN TRUE
 
***AttemptedSelectExpertFormula***
 
 
IP IP Logged
kostya1122
Senior Member
Senior Member
Avatar

Joined: 13 Jun 2011
Online Status: Offline
Posts: 475
Quote kostya1122 Replybullet Posted: 14 Mar 2012 at 10:55am
i forgot that you cant use summaries in select expert so
just got to section expert select details and click the X-2 button next to suppress(no drill down) and place a formula like
SUM({@TestFormula1}, {@Account#}) + SUM({@TestFormula2},{@Account#}) = 0


IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 14 Mar 2012 at 11:17am
my two cents...you can use (some) summaries for group select.
If i understand you correctly you just want to exclude a group if the sum of the amount for that account=0. (Your sample data already shows pos and neg values related to the XXX or YYY rows with no other row types).
if that is correct you can exlcude the group using the select expert set for group criteria with
NOT(sum(amount,account)=0)
if you have other rows in the grouping (account) that are not xxx or yyy that you want to ignore for your zero sum check you would ned to add another formula similar to kostya's suggestion and sum that
//groupchecker
if field in ['xxx','yyy'] then amount
then use that in the group select
NOT(sum(@groupchecker,account)=0)
 
if you also have to validate that there are the same number of xxx rows as yyy rows that can also be added
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