Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: IF...ELSE statement: the "ELSE" expression ignored Post Reply Post New Topic
Author Message
KartHol
Newbie
Newbie


Joined: 07 Dec 2015
Online Status: Offline
Posts: 2
Quote KartHol Replybullet Topic: IF...ELSE statement: the "ELSE" expression ignored
    Posted: 15 Dec 2015 at 2:02am
Hello,

I've set up a formula field that should display string dependent on input condition (IF...THEN...ELSE). When the condition evaluates to TRUE the THEN... expression is correctly displayed, but when it evaluates to FALSE nothing is displayed. How is that possible?

I've attached two screenshots - the first one showing the definition of the "RC" field with formula and its use in the group header, the other one with the actual report with the "RC" field's missing content.

I use Crystal Reports 2008.

Pavel






IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 15 Dec 2015 at 7:07am
My supervisor just had a similar issue with displaying a checkbox.  The only way we could get it to work was create a formula and reverse the true/false conditions.  Still do not understand why it would not work correctly.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 15 Dec 2015 at 9:08am
two things to consider
1. if you are dealing with NULL values, not empty strings then it will stop evaluating when it hits a NULL essentially returning nothing.
In the formula editor set the NULL option to 'use default values for null' to handle that condition.
Also you may want to trim the field in case it has a space in it.
2. Your formula is evaluating at the field level but is being displayed in the group header so it is only evaluating on the first row in the group and returning a result based on that row.
IP IP Logged
KartHol
Newbie
Newbie


Joined: 07 Dec 2015
Online Status: Offline
Posts: 2
Quote KartHol Replybullet Posted: 15 Dec 2015 at 9:04pm
ad 1: Yes, it was a NULL value! My fault, I should have noticed that. I rewrote the formula using IsNull() function and now it works correctly.
ad 2: this is OK as I'm grouping by an order number and "RC" is a customer reference number for that order so it's the same for all order items.

Thank you very much, DBlank, for help! :)
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.000 seconds.