Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Formula Not returning the right value Post Reply Post New Topic
Author Message
OKsoccer24
Newbie
Newbie


Joined: 05 Jun 2008
Online Status: Offline
Posts: 35
Quote OKsoccer24 Replybullet Topic: Formula Not returning the right value
     Posted: 05 Jun 2009 at 6:32am
if right(totext({@5th Month}),2) = '01'
then
{@5th Month} - 89
else
{@5th Month} - 1

here is my formula.  @5th Month is 200901 and it is a number.  When I run this it always runs the else.  What am I doing wrong here?
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 05 Jun 2009 at 6:42am

I am guessing that what you want is

f right(totext({@5th Month},0,""),2) = '01'
then
{@5th Month} - 89
else
{@5th Month} - 1
totext by default returns your 200901 as 200901.00.
 
generically, if it had been more complex, I would have said to test your formula by just returning the totext part of the code to make sure that your test was correct.
 
HTH
 
IP IP Logged
OKsoccer24
Newbie
Newbie


Joined: 05 Jun 2008
Online Status: Offline
Posts: 35
Quote OKsoccer24 Replybullet Posted: 05 Jun 2009 at 6:45am
Thank you!
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