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

Multiple date fields using common parameters

Status
Not open for further replies.

AussieLad

Technical User
Jul 17, 2002
17
AU
I'm obviously not a Crystal expert, so here's my CR8.5 query...
I've created a SQL view from our employee d'base which lists the Emp No, Name, and six separate 'Significant Date' fields.
(eg, 'End Probation Date', 'End Temp Status Date', etc).
I created '?Date Start' and '?Date End' Parameter fields, and hoped that the following report selection criteria would work...
(Emp.Date_1) in {?Date Start} to {?Date End}
or (Emp.Date_2) in {?Date Start} to {?Date End}
// and so on to "or (Emp.Date_6) in...."
However, the output is for all the dates that meet the criteria in (Emp.Date_1) ONLY, (or whichever field I used first in my testing), and none of the other fields.
Can a Parameter be used for multiple fields, or am I way off the mark with my criteria? Thanks.
 
I'm not sure whether this is the problem, but could any of the dates be null? If they are this could be causing your problem.

If Emp.date_1 exists, the criteria will be checked. If Emp.date_1 is null then the check will return null, and at this point Crystal tends to stop. You need to use an isNull stmt to sort this out:

(isNull(Emp.Date_1) or (Emp.Date_1) in {?Date Start} to {?Date End})
or (isNull(Emp.Date_2) or (Emp.Date_2) in {?Date Start} to {?Date End})
// and so on to "or (Emp.Date_6) in...."

the isNull needs to be the first thing you check in each part.

Also, I wouldn't do my date comparisons with an "in". I'd use BETWEEN, or use a >= and <= comparison. If your way works, then that's fine I just thought I should mention in case that's causing problems.

Sorry if I've rambled on and not helped at all!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top