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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parameter Error.

Status
Not open for further replies.

lpbruce1

MIS
Aug 2, 2004
15
0
0
US
Hi -

I need help, I've tried everything I can think of to get this to work, but no success. So I am hoping one you Crystal Guru's can assist me or at lest point me in the right directions.

I am using Crystal XI, my datasourse is a universe.

I have created a Parameter called ?AsOfDate, this parameter can either be a date or string type, whichever one will work.

Basically if an As of Date is not entered then the {?AsOfDate} needs to default to the currentdate, However, if an As Of Date is entered then the {?AsOfDate} needs return data where the:
{Main.Eligibility Date} <= {?AsOfDate} AND {Main.Record Cancel Date} >= {?AsOfDate}

This is one of codes/formulas I've tried:

if isnull({?Effective Date}) then Currentdate
else
(cdate({Main.Eligibility Date}) <= {?AsOfDate} AND cdate({Main.Record Cancel Date}) >= {?AsOfDate})


I've tried creating different variations of this formula but I keep getting errors that the section after the ELSE needs to be a string or a date

I've tried changing the parameter type from date to string but same error.

I've placed this code in the Select Records section same error,

I've tried to created a formula to place in the report, same error.


Also ({Main.Eligibility Date}) and ({Main.Record Cancel Date})) are both datetime fields, I've tried converting them to cdate or totext, but same error as above.

I know I must be way off on how to accomplish, any help would be greatly appreciated.

I hope my question and examples make sense, if you more explaination let me know, I'll be more than happy to provide what info you need.

Thank you for your help.

Lpbruce
 
OK, you're users are running reports from within Crystal Reports itself, or?

And where are you placing this formula?

The standard means would be something like this:

Create a parameter of type date, and set a default date of 1/1/1970 or some such.

In the Report->Selection Formulas->Record use:

if isnull({?Effective Date})
or
{?Effective Date} = cdate(1970,1,1) then
(cdate({Main.Eligibility Date}) <= currentdate AND cdate({Main.Record Cancel Date}) >= Currentdate
else
(cdate({Main.Eligibility Date}) <= {?AsOfDate} AND cdate({Main.Record Cancel Date}) >= {?AsOfDate})

This assumed that you want the dates to compare to currentdate when the user enters nothing, your original formula wasn't filtering anything in that instance.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top