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
<< Prev Page  of 3 Next >>
Author Message
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 12 Sep 2012 at 6:03am
placing that formula in the report footer will only evaluate for the last row in the report. so whatever the last detail row is it is not an AB hence it is showing you the " ".
 
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:34am
I now see I might need 2 conditions as the first value is blank so, trim({table.field})<>'AB' did not work. any help?
Thank you
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 12 Sep 2012 at 7:11am

you seem to be trying to get an something across multiple rows. Are you trying to show AB for a group footer if the group had any AB in in it? or something like that?

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 7:24am
I moved the block to the header and need these 4 different values to show under different conditions.
if it is red show "AB"
if it is blue show "CD"

etc...
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 12 Sep 2012 at 7:31am
you need to sumamrize across rows
the easiest way is convert your values into 1 or 0 and then sum that.
I am assuming you have it in a grouping and are placing this in a group footer. This will also work in a group header
here is an sample for you 'ab' column called AB_flag
if {table.field}='AB' then 1 else 0
sum this at the group level
sum(@AB_flag,table.groupfield)
this will give you a 0 if there were no ABs and any value >0 if there were
you can use that result to create text or color or whatever
 
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 8:39am
Thank you for your help but still nor working.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 12 Sep 2012 at 8:41am
did you convert each to a 1 and 0?
did you sum them and place in the group footer or header?
does this give you expected numeric results?


Edited by DBlank - 12 Sep 2012 at 8:41am
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 8:48am
These are string values so cannot sum it up.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 12 Sep 2012 at 9:21am

you are suppsoed to create a formula to convert your string to 1 or 0 and then you sum that formula field

//AB_flag example
if field='AB' then 1 else 0
IP IP Logged
crystalgal
Groupie
Groupie
Avatar

Joined: 20 Feb 2009
Location: United States
Online Status: Offline
Posts: 66
Quote crystalgal Replybullet Posted: 13 Sep 2012 at 8:19am
Sorry, was out half of the day
Yes, I did all you have suggested and out of 4, 2 are blank and 2 have values. But when I placed them in the header of the report only one value shows and 2nd one is blank. Don't know why. Thank you.
IP IP Logged
<< Prev 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.047 seconds.