Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Formula - Compare Neg Numbers Post Reply Post New Topic
Author Message
ashline
Newbie
Newbie


Joined: 22 May 2010
Online Status: Offline
Posts: 15
Quote ashline Replybullet Topic: Formula - Compare Neg Numbers
     Posted: 01 May 2013 at 3:03pm
So here is a challenging one.
I have two formulas that perform a calculation and return a number for each result. When I hover over the result it is in fact seeing the result as a number and not a string.
I then have a third formula:

if X > Y then "X is bigger"
Else X < Y then "X is smaller"

It works great but in one instance I’m comparing two negative values. The value are -28 and -7
Crystal returns that -28 is a bigger value then -7? What??

Of course if I create a straight formula that only has the numbers in it and not a result from another formula crystal knows that -28 is smaller than -7
Any thoughts?


Edited by ashline - 01 May 2013 at 3:04pm
IP IP Logged
Sastry
Moderator
Moderator
Avatar

Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
Quote Sastry Replybullet Posted: 01 May 2013 at 11:18pm
Hi

May be when you are comparing two values, it will take negetive highest number i.e. value wise it may be low but when u compare -28 is bigger than -7 in negetive format.

Thanks,
Sastry
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 02 May 2013 at 4:41am
I would verify that the values that you think it is evlauting on that row are actually the ones being used.
Insert X and Y on that detail row and see what is going on.
 
if you create a formula as
(-28)>(-7)
and palce it on your report it will return a False
 
IP IP Logged
ashline
Newbie
Newbie


Joined: 22 May 2010
Online Status: Offline
Posts: 15
Quote ashline Replybullet Posted: 02 May 2013 at 5:22am
thanks for the reply. I verified the values that were being used. It must have been something further up stream that was causing an issue.

I developed a work around by adding 100 to each value then doing the comparison. That way the lowest value I would ever have is 0. -100 by adding 100 all my comparisons will be a positive number.

Thanks again
IP IP Logged
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