Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Conditional Suppress of Section Post Reply Post New Topic
Author Message
JaneM
Newbie
Newbie


Joined: 28 Oct 2011
Online Status: Offline
Posts: 7
Quote JaneM Replybullet Topic: Conditional Suppress of Section
     Posted: 28 Oct 2011 at 8:15am
Hi,
 
I want to suppress the detail section of my report unless one of four  conditions, each involving a different field, are true.
 
I am using SECTION EXPERT, highlighted the Details Section, clicked on "Suppress (No Drill-Down)", and the "x=2" button to enter the FORMULA WORKSHOP.
 
What I think should work is:
----------------------
// EXAMPLE #1
// Assume the record should be suppressed
True;
 
// Test whether the record meets the criteria to included
IF (field1 condition is true) Then False;
IF (field2 condition is true) Then False;
IF (field3 condition is true) Then False;
IF (field4 condition is true) Then False;
-----------------------
 
The above doesn't work (all records appear) and I tested it with the following really simply example:
--------------------------:
// EXAMPLE #2
// Assume the record should be suppressed
True;
 
// Test one case whether record meets the criteria to included
IF {AGRMNTS.AGRMNTID} startswith "x" Then False;
----------------------------;
 
Only three records meet the IF condition.  With the above code, all records are shown.
 
Meanwhile the following code does work:
--------------------------
// EXAMPLE #3
IF {AGRMNTS.AGRMNTID} startswith "x" Then
          False
ELSE
          True;
----------------------------
 
If I could nest the IF statements then I could go that route, but one ELSEIF isn't enough to cover the number of conditions.
 
I have also tried the above stuff:
- with "Suppress (No Drill-Down)" unclicked with same results.
 
I must be missing something really simple
 
Any pointers very very welcome.
 
Thanks,
Jane
IP IP Logged
FrnhtGLI
Senior Member
Senior Member
Avatar

Joined: 22 May 2009
Online Status: Offline
Posts: 347
Quote FrnhtGLI Replybullet Posted: 28 Oct 2011 at 10:12am
You could just enter it without the IF statement:

{table.field1}='WWWW'
and
{table.field2}='XXXX'
and
{table.field3}='YYYY'
and
{table.field4}='ZZZZ'


With the above, all the fields would have to meet the criteria to be suppressed. It will only take one of the conditions to not meet the criteria for the section to not be suppressed.

HTH
|< /\ '][' ( )
IP IP Logged
JaneM
Newbie
Newbie


Joined: 28 Oct 2011
Online Status: Offline
Posts: 7
Quote JaneM Replybullet Posted: 30 Oct 2011 at 2:45am
Thanks.  I'll try that approach on Monday.  Do you know what was wrong with my approach?  
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