Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Report Design
Message Icon Topic: If then else not working Post Reply Post New Topic
Page  of 3 Next >>
Author Message
crystalgal
Groupie
Groupie
Avatar

Joined: 20 Feb 2009
Location: United States
Online Status: Offline
Posts: 66
Quote crystalgal Replybullet Topic: If then else not working
    Posted: 12 Sep 2012 at 4:42am
Hello all,

I have AB, BC, ED, KL data in database. my formula is
If thecolumn = "AB" then showthecolumn
else " "
when i run this sql it gives me blank.

what am I missing?

TIA
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 12 Sep 2012 at 4:46am
1. is your exmplaes one long stinrg and you need to check it or is it ab on one row BC on another row etc.?
2. are you trying to filter the data or conditionally hide something?
3. where are you creating the formula?
IP IP Logged
crystalgal
Groupie
Groupie
Avatar

Joined: 20 Feb 2009
Location: United States
Online Status: Offline
Posts: 66
Quote crystalgal Replybullet Posted: 12 Sep 2012 at 4:55am
Thank for the response
1) each row has different values 'AB','BC','DE','EF'
2) Just trying to filter data.
3) in formula section

hope this helps.
thanks





IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 12 Sep 2012 at 5:01am
filtering is done int he select expert
click on the icon with the hand pulling the red sphere from the blue spheres.
add your selection criteria there
table.field='AB'
IP IP Logged
crystalgal
Groupie
Groupie
Avatar

Joined: 20 Feb 2009
Location: United States
Online Status: Offline
Posts: 66
Quote crystalgal Replybullet Posted: 12 Sep 2012 at 5:12am
My sql already has a condition where column IN('AB','CD','EF','GH')
I need all the four values in appropriate section in the report so If I do as you mention I will not get all other values. that is why I used in formula.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 12 Sep 2012 at 5:26am
That is why I asked what it was for...?
I am confused as to what you are trying to accomplish...Are you trying to conditionally show/hide a column header here? or just show or hide the field?


Edited by DBlank - 12 Sep 2012 at 5:26am
IP IP Logged
crystalgal
Groupie
Groupie
Avatar

Joined: 20 Feb 2009
Location: United States
Online Status: Offline
Posts: 66
Quote crystalgal Replybullet Posted: 12 Sep 2012 at 5:34am
sorry for the confusion.
out of different values I need the above mentioned values, which i need to use with different specification.
example:
1) if the value has AB then it goes to section 1
2) if the value has CD then it goes to section 2
and etc...

hope this helps
thanks
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 12 Sep 2012 at 5:42am
Your code structure looks fine so it is more likely to do with the data itself.
try and trim it to get rid of any spaces that you cannot see in the data
 
if trim({table.field})= "AB" then trim({table.field}) 


Edited by DBlank - 12 Sep 2012 at 5:44am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 12 Sep 2012 at 5:44am
if you are looking to display the field in different columns based on the value you can place the field in each column and use conditional suppression on each field
right click on the field and select format then the suppression formual button and add you rboolean fomrula there
 
trim({table.Field})<>'AB'


Edited by DBlank - 12 Sep 2012 at 5:45am
IP IP Logged
crystalgal
Groupie
Groupie
Avatar

Joined: 20 Feb 2009
Location: United States
Online Status: Offline
Posts: 66
Quote crystalgal Replybullet Posted: 12 Sep 2012 at 6:01am
Tried everything and noting is working. Does Report footer has some rules? this part of the values are going on the report footer and would not take any conditions I am using.
IP IP Logged
Page  of 3 Next >>
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.016 seconds.