Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: formula? Post Reply Post New Topic
Author Message
jbalbo
Senior Member
Senior Member
Avatar

Joined: 17 Feb 2011
Online Status: Offline
Posts: 219
Quote jbalbo Replybullet Topic: formula?
     Posted: 21 Mar 2011 at 1:07pm
Hi,

Im trying to create a field to write according to a value:
For example
if field1 = 1 then field2(Which I create) = field3 + "months"

so field1 is coded for month , field3 is number of months, field2 is the
concatination.

Field1 = 1
Field3= 4
I want field2 to say "4 month(s)"


Does this make sense?

Thanks
Joe


IP IP Logged
FrnhtGLI
Senior Member
Senior Member
Avatar

Joined: 22 May 2009
Online Status: Offline
Posts: 347
Quote FrnhtGLI Replybullet Posted: 22 Mar 2011 at 2:05am
if {table.field1}=1
     then {table.field3} & ' months'
          else (whatever you want your else to be)
|< /\ '][' ( )
IP IP Logged
jbalbo
Senior Member
Senior Member
Avatar

Joined: 17 Feb 2011
Online Status: Offline
Posts: 219
Quote jbalbo Replybullet Posted: 22 Mar 2011 at 2:58am
that works great .. thanks..
 
but becuase the field in numeric, I get 1.00, I want just 1 ?
 
Thanks in Advance...
IP IP Logged
FrnhtGLI
Senior Member
Senior Member
Avatar

Joined: 22 May 2009
Online Status: Offline
Posts: 347
Quote FrnhtGLI Replybullet Posted: 22 Mar 2011 at 3:17am
if {table.field1}=1
     then totext({table.field3}, 0) & ' months'
          else (whatever you want your else to be)
 
The correction above to {table.field3} should get you your desired result.
|< /\ '][' ( )
IP IP Logged
jbalbo
Senior Member
Senior Member
Avatar

Joined: 17 Feb 2011
Online Status: Offline
Posts: 219
Quote jbalbo Replybullet Posted: 22 Mar 2011 at 10:47am
Thanks works great..
What if  I want to display another field(  a date field) if the value is -1?
 
if field1 = -1 then I want to display field5..
can I hide field3 and make field5 visble if field1 = -1?
 
Thanks
 
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