Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Report Design
Message Icon Topic: Formula to suppress fields based on two conditions Post Reply Post New Topic
Author Message
chengkeh
Newbie
Newbie


Joined: 07 Jun 2011
Location: Malaysia
Online Status: Offline
Posts: 2
Quote chengkeh Replybullet Topic: Formula to suppress fields based on two conditions
    Posted: 07 Jun 2011 at 6:10pm
hi...
 
i am new here...
just wanna ask bout how to suppress when i have two conditions.
 
the situasion is like this.
i have a template that i designed which got
 
details g
details h
details i
details j
 
condition detail g which should suppress when
 
data type = '001' OR
data type = '002' OR
data type = '003' OR
data type = '004' AND
(create date >= ('2011-01-01')
 
condition detail h which should suppress when
 
data type = '001' AND
(create date >= ('2011-01-01')
 
condition detail i which should suppress when
 
data type = '001' OR
data type = '002' OR
data type = '003' OR
data type = '004' AND
(create date < ('2011-01-01')
 
condition detail j which should suppress when
 
data type = '001' AND
(create date < ('2011-01-01')
 
 
its actually
detail g VS I
detail h VS j
 
 
i did my code somthing like this, it shows that there is no error found
somehow it turn to show the detail g and i at the same time which i dont want that happen.it suppose to show only one, its  either g or i, based on the create date. Can somebody help me out...
 
detail g
=====
{SEB17L01.IN_ASM-NOTICE_ASM-TYPE_2} = "062" OR
{SEB17L01.IN_ASM-NOTICE_ASM-TYPE_2} = "064" OR
{SEB17L01.IN_ASM-NOTICE_ASM-TYPE_2} = "063" OR
{SEB17L01.IN_ASM-NOTICE_ASM-TYPE_2} = "166" OR
{SEB17L01.IN_ASM-NOTICE_ASM-TYPE_2} = "033" AND
{SEB17L01.IN_ASM-NOTICE_CREATE-DT_9} > = date (2011,01,01)
 
 
detail i
=====
if {SEB17L01.IN_ASM-NOTICE_ASM-TYPE_2} = "062" OR
{SEB17L01.IN_ASM-NOTICE_ASM-TYPE_2} = "064" OR
{SEB17L01.IN_ASM-NOTICE_ASM-TYPE_2} = "063" OR
{SEB17L01.IN_ASM-NOTICE_ASM-TYPE_2} = "166" OR
{SEB17L01.IN_ASM-NOTICE_ASM-TYPE_2} = "033" AND
({SEB17L01.IN_ASM-NOTICE_CREATE-DT_9} < date (2011,01,01))
then TRUE
   
 
 
 
IP IP Logged
FrnhtGLI
Senior Member
Senior Member
Avatar

Joined: 22 May 2009
Online Status: Offline
Posts: 347
Quote FrnhtGLI Replybullet Posted: 08 Jun 2011 at 2:17am
Try some parenthesis around the OR statements to separate them from the AND. Also, you do not need an if/then in the suppression section as it already evaluates it that way. So something like:

detail g
=====
({SEB17L01.IN_ASM-NOTICE_ASM-TYPE_2} = "062" OR
{SEB17L01.IN_ASM-NOTICE_ASM-TYPE_2} = "064" OR
{SEB17L01.IN_ASM-NOTICE_ASM-TYPE_2} = "063" OR
{SEB17L01.IN_ASM-NOTICE_ASM-TYPE_2} = "166" OR
{SEB17L01.IN_ASM-NOTICE_ASM-TYPE_2} = "033")
 AND
({SEB17L01.IN_ASM-NOTICE_CREATE-DT_9} > = date (2011,01,01))
 
 
detail i
=====
({SEB17L01.IN_ASM-NOTICE_ASM-TYPE_2} = "062" OR
{SEB17L01.IN_ASM-NOTICE_ASM-TYPE_2} = "064" OR
{SEB17L01.IN_ASM-NOTICE_ASM-TYPE_2} = "063" OR
{SEB17L01.IN_ASM-NOTICE_ASM-TYPE_2} = "166" OR
{SEB17L01.IN_ASM-NOTICE_ASM-TYPE_2} = "033")
 AND
({SEB17L01.IN_ASM-NOTICE_CREATE-DT_9} < date (2011,01,01))


Not sure if this will get you the desired effect, but I know how Crystal can be when not separating the statements that way.

Hope that gets you somewhere.
|< /\ '][' ( )
IP IP Logged
chengkeh
Newbie
Newbie


Joined: 07 Jun 2011
Location: Malaysia
Online Status: Offline
Posts: 2
Quote chengkeh Replybullet Posted: 08 Jun 2011 at 2:48pm

hi there,
i did try, but it didnt work.the samething happen like what i did.
thanx any way...

 
i did try this and i dont know whether its true as other people who have the same thing as me used to do it or what.but it works for now. 
 

1.in section expert for details, i write the date code

detail g-{SEB17L01.IN_ASM-NOTICE_CREATE-DT_9} >= date(2011,01,01)
 
detail h-{SEB17L01.IN_ASM-NOTICE_CREATE-DT_9} >= date (2011,01,01)

detail i-{SEB17L01.IN_ASM-NOTICE_CREATE-DT_9} <  date (2011,01,01)
 
detail j- {SEB17L01.IN_ASM-NOTICE_CREATE-DT_9} <  date (2011,01,01)

2.i create a blank subreport for every details section (details g,h,i,j) and write the data type code in sub report format.
 
detail g
 
{SEB17L01.IN_ASM-NOTICE_ASM-TYPE_2} = "062" OR
{SEB17L01.IN_ASM-NOTICE_ASM-TYPE_2} = "064" OR
{SEB17L01.IN_ASM-NOTICE_ASM-TYPE_2} = "063" OR
{SEB17L01.IN_ASM-NOTICE_ASM-TYPE_2} = "166" OR
{SEB17L01.IN_ASM-NOTICE_ASM-TYPE_2} = "033"
 
 
detail i
 
{SEB17L01.IN_ASM-NOTICE_ASM-TYPE_2} = "062" OR
{SEB17L01.IN_ASM-NOTICE_ASM-TYPE_2} = "064" OR
{SEB17L01.IN_ASM-NOTICE_ASM-TYPE_2} = "063" OR
{SEB17L01.IN_ASM-NOTICE_ASM-TYPE_2} = "166" OR
{SEB17L01.IN_ASM-NOTICE_ASM-TYPE_2} = "033"
 

3.in subreport tab, i check for the surpress blank subreport


Edited by chengkeh - 08 Jun 2011 at 2:54pm
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.031 seconds.