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

Multiple Conditions for record select, not apparent in Select Expert

Status
Not open for further replies.

adriae

Technical User
Oct 7, 2011
16
US
Hi,

I'm running Crystal Reports 2011 and need to restrict my report results based on two conditions. I cannot figure out how to apply both of these conditions in Select Expert.

I have employee status records that are either "Full Time" or "Terminated". The "Full Time" records have a null termination date field, and the "Terminated" records have the applicable termination date.

For my report, I would like to select only the "Full Time" employee records, as well as the "Terminated" employee records AS LONG AS the termination date is within the past 12 months (for example, I am now trying to run a report for November that takes into consideration all full-time employees and employees that were terminated on or after November 1, 2010.)

Any suggestions would be greatly appreciated!!
 

Often you exceed the ability of the Select Expert to do what you want, and you can never use it with an Or clause.

In the Select Expert, with no conditions defined, click the Formula Editor button. Your formula will be something very similar to this:

{yourtable.Status} = "Full Time"
or
({yourtable.Status} = "Terminated" and {yourtable.terminationdate} >= date(year(currentdate) - 1,month(currentdate),1)

Technically speaking you don't need to test for terminated status since the only records with term dates are for terminated employees. I'd leave it in anyway.

 


Think I left off the closing paren:

{yourtable.Status} = "Full Time"
or
({yourtable.Status} = "Terminated" and {yourtable.terminationdate} >= date(year(currentdate) - 1,month(currentdate),1))

 
You can also just go directly to report->selection formula->record and enter your formula directly there, bypassing the select expert altogether. I personally never use it.

-LB
 
Thanks so much for your responses. I will give this a try.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top