Print Page | Close Window

if, then else statement

Printed From: Crystal Reports Book
Category: Crystal Reports .NET 2003
Forum Name: Writing Code
Forum Discription: .NET 2003 programming API, report integration
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=20740
Printed Date: 28 Mar 2024 at 5:02am


Topic: if, then else statement
Posted By: south
Subject: if, then else statement
Date Posted: 15 May 2014 at 10:31am
I keep getting an error an am not sure why my formula reads:
if {Est.Hrs}=0 then (({Lead.Days})"D") else {Est.Hrs}
It works fine if I get rid of the "D" and keep it really simple, but I was to identify when it days and when it is hrs.  Thanks for your help!



Replies:
Posted By: kevlray
Date Posted: 15 May 2014 at 10:45am
You do not have a function associated with {Lead.Days}.  Did you want to use the datepart function?


Posted By: south
Date Posted: 16 May 2014 at 2:05am
{Est.Hrs} returns the number of hours assigned, I would like the {Lead.Days} to return the number of days assigned and would like to have a "d" appear at the end of that number so people are aware that it is days not hours.  Right now if I take out the "D" in the formula, I get the correct results but it  say "3" and I would like it to say "3 D". I want people to know it's 3 Day not hours.


Posted By: kevlray
Date Posted: 16 May 2014 at 6:17am
Then you would probably do something like this:
if {Est.Hrs}=0 then totext({Lead.Days},0)+" D" else {Est.Hrs}



Print Page | Close Window