Saturday, February 11, 2012

4 different criteria, Crystal Reports 7

Hi,

I have a report that I need some help with. I have 4 different evaluations and if either set of 2 is true, I want to have them displayed on the resulting report.

This is what I put it, maybe someone can offer some suggestions to help it work right.

{MasterLog.DateOff} = (CurrentDate) And
{MasterLog.TimeOff} < (DateTime(0,0,0,6,30,00))
Or
{MasterLog.DateOff} = Date(Year(CurrentDate), Month(CurrentDate), Day(CurrentDate) - 1) And
{MasterLog.TimeOff} > (DateTime(0,0,0,6,30,00))

This report is looking for any row that is equil to today and the time field is less than 6:30 AM. Or Yesterday's date and that rows time greater than 6:30 AM.

The 2 fields are date/time fields not converted to date in the report options. I formatted them in the report but I dont think that is where the problem is. I believe its in my formula.

If either set of criteria is true, then print that row in the report.

What I get back is all of yesterdays rows but none of todays rows that fit the criteria. I did make sure that there was data to show in the database.

Its a MSaccess 2002 format.

Any suggestions? Further clarifications?

intercepterAnd after spending a couple hours working further, I have my solution.

It appears first off I wasnt formatting correctly for the database fields I was using. Also, I should have enclosed the 2 sets of criteria in ( ) between the or.

So, the resuting formula is:

({MasterLog.DateOff} = Date(Year(CurrentDate), Month(CurrentDate), Day(CurrentDate) - 1) and
{MasterLog.TimeOff} >= DateTime (1899, 12, 30,06, 30, 00)) or
({MasterLog.TimeOff} <= DateTime (1899, 12, 30,06, 30, 00) and
{MasterLog.DateOff} = CurrentDate)

I hope this helps someone else.

intercepter

No comments:

Post a Comment