Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using DateTime field in if,then,else statement

Status
Not open for further replies.

Luvsql

Technical User
Apr 3, 2003
1,179
CA
I am using Crystal 9 (if using any other version, I wouldn't be having the problem as file > report option > convert datetime to date could be chosen). I have a datetime field that I need to use in comparisons ie:

if {datefield}<={?Date}
then {anotherfield}
else 0

The {?Date} field has been setup as a date parameter. When I place the formula into the details, it doesn't work ie it is printing as if the statement is true for dates that are less than the parameter entering.

This is so frustrating having to deal with datetime fields. Why the (*&@$# did Business Objects remove the option to convert all datetimes to dates?

I also tried creating a formula cdate({datefield}) and using that, but that doesn't work either.

 
Given that {datefield} is a datetime field then

if date({datefield})<={?Date}
then {anotherfield}
else 0

-LW
 
it doesn't work ie it is printing as if the statement is true for dates that are less than the parameter entering.

Your formula is set up to do just that. Are you using the incorrect sign in your formula? Do you mean ">="?

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top