Report Design
 Crystal Reports Forum : Crystal Reports .NET 2003 : Report Design
Message Icon Topic: Conditional Text Field Post Reply Post New Topic
Author Message
mgriba
Newbie
Newbie


Joined: 10 Mar 2008
Online Status: Offline
Posts: 5
Quote mgriba Replybullet Topic: Conditional Text Field
    Posted: 10 Mar 2008 at 3:48pm

Ok, first time ever using CR and I must say it is great!  I have my report almost completed, but have one lingering problem - I need to add a text object that is populated conditionally based on the contents of a database field.  Is there a way to do this?

 
For example, I have numerous records with the need to indicate (in a text box, or some other object) one of two things - "PAST DUE" or "BASE" based on the contents of another field (database) per record.
 
Thank you.
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 10 Mar 2008 at 4:02pm
This is fairly easy using an "If...Then...Else" statement in a formula.  If you would like a sample, please post the conditions that determine "Past Due" or "Base".
 
-Dell
IP IP Logged
mgriba
Newbie
Newbie


Joined: 10 Mar 2008
Online Status: Offline
Posts: 5
Quote mgriba Replybullet Posted: 10 Mar 2008 at 4:04pm
For "BASE" the database field in question must be the current month, for "PAST DUE" the same database field in question must be < current month.  Thank you so much for the quick reply.
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 10 Mar 2008 at 4:18pm

Try something like this (you may have to tweak it...)

If month({table.datefield}) = month(CurrentDate) then 'BASE'
else if month({table.datefield}) < month(CurrentDate) then 'PAST DUE'
 
Place this formula on the report where you want the text to appear.
 
-Dell
IP IP Logged
mgriba
Newbie
Newbie


Joined: 10 Mar 2008
Online Status: Offline
Posts: 5
Quote mgriba Replybullet Posted: 10 Mar 2008 at 4:21pm
Sorry to bother again - since you have helped so much.  But, on Crystal Reports 2008 (which I'm using), how do I go about placing code without an object container to hold it?  Thank you again.
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 10 Mar 2008 at 4:36pm
I'm not familiar with CR 2008.  However, if it's similar to previous versions, in the Field Explorer where you see your database fields, there should be an entry called "Formula Fields".  Right-click on it and select "New".  Enter the formula and then save it.  Crystal will let you know if there's a problem in the formula.  After it's saved, just drag it onto your report.
 
-Dell
IP IP Logged
mgriba
Newbie
Newbie


Joined: 10 Mar 2008
Online Status: Offline
Posts: 5
Quote mgriba Replybullet Posted: 12 Mar 2008 at 11:41am
Worked like a charm!  Thank you again.  This is my first post here as well.  Is there a rating system/points system for the awesome replies you gave me?
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 12 Mar 2008 at 12:56pm

Not that I know of, but I appreciate the thought!

-Dell
IP IP Logged
mgriba
Newbie
Newbie


Joined: 10 Mar 2008
Online Status: Offline
Posts: 5
Quote mgriba Replybullet Posted: 12 Mar 2008 at 3:51pm
If I could load this up on our GoDaddy hosted (yuck!) account and pass a form variable from a login field to filter out the data for a particular user without spending any extra cash, I would be a rockstar.  But, in a one man IT department, being jack of all trades, master of none, I will revisit that when the heavier fires are put out first.  Thanks.
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.015 seconds.