Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Report Design
Message Icon Topic: Multiple If Statements Post Reply Post New Topic
Author Message
ramz003
Newbie
Newbie


Joined: 15 Aug 2012
Online Status: Offline
Posts: 16
Quote ramz003 Replybullet Topic: Multiple If Statements
    Posted: 17 Apr 2015 at 3:18am
Hello.
I'm dealing with multiple if then statements that could be dealing with a subtraction between 2 negative numbers but it appears once it meets the first statement it skips the rest. Thanks for any help
Here is how the report is looking.

Variance   Change   Variance Prior
($6)           $19           ($13)   <-- should be ($19)
$100          $200          $300
($2487)      $7461      ($4974) <-- should be negative


Here is the formula i'm using

if {@Variance} < 0 and  {@Variance Prior} < 0
then
({@Variance Prior} * (-1)) - ({@Variance} * (-1)) *-1
else
if {@Variance} < 0 then
{@Variance Prior}- ({@Variance} * (-1))
else
if {@Variance Prior} < 0 then
{@Variance} - ({@Variance Prior} * (-1))
else
{@Variance} - {@Variance Prior}

IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 20 Apr 2015 at 6:04am
did you label your columns incorrectly in your sample data?
is you sample 3 distinct rows of data or are these group summary values?
IP IP Logged
ramz003
Newbie
Newbie


Joined: 15 Aug 2012
Online Status: Offline
Posts: 16
Quote ramz003 Replybullet Posted: 20 Apr 2015 at 6:07am
Thanks for the reply DBlank

These are group summary values.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 20 Apr 2015 at 7:22am
what are your two formula doing {@Variance} & {@Variance Prior} ?

Edited by DBlank - 20 Apr 2015 at 7:23am
IP IP Logged
ramz003
Newbie
Newbie


Joined: 15 Aug 2012
Online Status: Offline
Posts: 16
Quote ramz003 Replybullet Posted: 20 Apr 2015 at 8:17am
Both are calculation based off another fields in the report.

A-B = Variance
Same for prior just in a sub report.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 20 Apr 2015 at 8:48am
having a very hard time 'seeing' you actual data.
your passing some summary data back to the main report via shared variables and I don't know where any of these sub reports are running, where the shared variables are in the main report, what the calculations are doing in the main report and where they are at and then then where you are running these variance/variance  prior formula.
 
In general when a formula 'skips' if-then conditions it is becuase it has either hit a NULL value and just stopped altogether or the first condition set was met and it stopped fofr that reason.
 
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.