Link to home
Start Free TrialLog in
Avatar of grahamcorp
grahamcorp

asked on

Checking data parameter is empty or null

Hi,

I have a crystal report in which I want to allow the user to enter a date parameter, but if they don't I want to put in place a default date range.

My current code is attached.  I know I can't do the '' as the forumla expects a date type so won't compile and most likely the isnull is really only for checking database values, so thats prob out too, but it gives an idea of what I want to do.
//If no start date was given, then run the report for the reportPeriod of months from the given endDate.
if ( isNull({?Start_Date}) OR {?Start_Date} = '' ) Then 
    ( Date(DateAdd ("m",-{?reportPeriod_Months},cDate(year({@EndDate}), month({@EndDate}), 01))) ) 
else 
    {?Start_Date};

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of James0628
James0628

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of James0628
James0628

For the record, I was referring to running the report from within CR 10.  If you're running the report via some other application, your options may be different.

 James
Avatar of grahamcorp

ASKER

Thanks James,
I had a funny feeling this was going to be the case, so have change the report, instead of taking it a start and end date it will now take in a month time period and the report itself will work out the start and end dates.
Glad I was able to help, even if it was only to tell you "you can't get there from here".  :-)

 James