I'm a Crystal Reports beginner, and I'm working on a report where I'm trying to set up a date-range query with optional end points. So, for example, if the user picks a starting date, the report only includes results from after the starting date. Similarly, if the user selects an end date, the report only includes results from before the end date.
I am using the following filter, but the previewer keeps complaining that a date is missing. (In the testing I'm doing, I picked a start date and no end date. The previewer complains that I don't have an end date)
datevar start := IIF(HasValue({?Start Date}) and not isNull({?Start Date}), {?Start Date}, Date(1900, 01, 01));
datevar end := IIF(HasValue({?End Date}) and not isNull({?End Date}), {?End Date}, Date(3000, 12, 31));
({APPT.DATE} in start to end)
So, as you can see, the intention is to check if the report has the {?End Date} parameter defined. If it does, we use it. If it does not, we pick a "huge" date. But apparently, IIF requires the true branch to be defined even if it isn't used.
Is there a similarly clean way of encoding this logic with the Crystal reports language?