Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Conditional text in the Text Object Post Reply Post New Topic
Author Message
Piotror
Newbie
Newbie


Joined: 18 Sep 2007
Location: Canada
Online Status: Offline
Posts: 4
Quote Piotror Replybullet Topic: Conditional text in the Text Object
    Posted: 18 Sep 2007 at 10:05am
Hi all,
 
I am new to CR and I am trying to set a conditional text display in the Text Object depending on the date:
if date > today then
"XYZ"
else
"FGH"
 
is it possible?
Richard
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 18 Sep 2007 at 11:48am
Create a formula and drop the formula field on your report. I have some free sample chapters from my new book online if you need to learn more about CR XI.
http://www.crystalreportsbook.com/CrystalReportsXI.asp
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
ScubaVal
Newbie
Newbie
Avatar

Joined: 09 Mar 2007
Location: United States
Online Status: Offline
Posts: 12
Quote ScubaVal Replybullet Posted: 18 Sep 2007 at 11:48am
Create a formula with a stringvar variable with an if else statement.  Then place the formula in the report.
try it... if it doesn't work, google it
IP IP Logged
Piotror
Newbie
Newbie


Joined: 18 Sep 2007
Location: Canada
Online Status: Offline
Posts: 4
Quote Piotror Replybullet Posted: 19 Sep 2007 at 6:40am
Thaks, but it does not work on the Text Object Unhappy
Richard
IP IP Logged
Piotror
Newbie
Newbie


Joined: 18 Sep 2007
Location: Canada
Online Status: Offline
Posts: 4
Quote Piotror Replybullet Posted: 19 Sep 2007 at 6:47am
Originally posted by BrianBischof

Create a formula and drop the formula field on your report. I have some free sample chapters from my new book online if you need to learn more about CR XI.
http://www.crystalreportsbook.com/CrystalReportsXI.asp
 

Thanks Brian, it is still magic to me. Could you be more specific please?

Actually I found the work around - I have created 2 text objects with a different text and suppressed them depending on the date. It works, but looks a bit awkward to me.

 
Richard
 

 

Richard
IP IP Logged
ScubaVal
Newbie
Newbie
Avatar

Joined: 09 Mar 2007
Location: United States
Online Status: Offline
Posts: 12
Quote ScubaVal Replybullet Posted: 19 Sep 2007 at 7:34am

Piotror,

I'm not Brian, but I think I can answer your question.
 
You already have the formula.  Click on the formula button, name the formula, then enter:

If {fieldname} > CurrentDate then

StringVar txtName := "XYZ"

else

StringVar txtName := "ABC"

Save and close the formula window.  Find the formula on the Fields list and drag it onto your report.

try it... if it doesn't work, google it
IP IP Logged
Piotror
Newbie
Newbie


Joined: 18 Sep 2007
Location: Canada
Online Status: Offline
Posts: 4
Quote Piotror Replybullet Posted: 19 Sep 2007 at 8:34am
Originally posted by ScubaVal

Piotror,

I'm not Brian, but I think I can answer your question.
 
You already have the formula.  Click on the formula button, name the formula, then enter:

If {fieldname} > CurrentDate then

StringVar txtName := "XYZ"

else

StringVar txtName := "ABC"

Save and close the formula window.  Find the formula on the Fields list and drag it onto your report.

 
 
That's great! Thank you, it is much more elegant than my solution.
 
Richard
 
 
Richard
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.016 seconds.