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!

Supression formula problem

Status
Not open for further replies.
Mar 10, 2004
53
US
CR 8.5 / SQL Server 2000

I'm having problems with suppressing sections via the section report.

Basically have a report that should show employees that are minors and are out of compliance based on labor laws. My detail section is hidden and i'm using it to sum up the time worked and showing the sum in the group footer. I'm also doing a maximum on the clock out time to determine their last recorded clock out.

My report looks like below without applying any of the labor logic yet.

Name Age WorkDate Clock-out Time #hrs Worked
John Doe 17 Mon, 7/5/04 7/1/04 4:00pm 6
John Doe 17 Tue, 7/6/04 7/2/04 8:00pm 4
John Doe 17 Wed, 7/7/04 7/3/04 11:00pm 4


I need the report to look like below based on the rule of no minor can work after 10pm OR not have worked more than 5 hrs during Monday thru Thursday.

Name Age WorkDate Clock-out Time #hrs Worked
John Doe 17 Mon, 7/5/04 7/1/04 4:00pm 6
John Doe 17 Wed, 7/7/04 7/3/04 11:00pm 4

But am getting the following results after I try to suppress section with the formula below:

DayOfWeek ({VP_TOTALS.APPLYDATE}) in [2,3,4,5] and
({@HrsWorked} < 5 or time(Maximum ({VP_TOTALS.CLOCKOUT}, {VP_TOTALS.WORKDATE}, "daily")) <= ctime("10:00 PM"))


Name Age WorkDate Clock-out Time #hrs Worked
John Doe 17 Wed, 7/7/04 7/3/04 11:00pm 4

It doesn't look like it's doing an OR. How should I change the condition so it does?

TIA
 
Hi,
Just to make it easier to read, fix the ('s locations:
Code:
(
 DayOfWeek ({VP_TOTALS.APPLYDATE}) in [2,3,4,5] and 
 {@HrsWorked} < 5
 )
OR
( 
time(Maximum ({VP_TOTALS.CLOCKOUT}, {VP_TOTALS.WORKDATE}, "daily")) <= ctime("10:00 PM"))
)

Not sure I got all the matching pairs of ( s..

[profile]

 
According to your logic with:
({@HrsWorked} < 5 or time(Maximum ({VP_TOTALS.CLOCKOUT}, {VP_TOTALS.WORKDATE}, "daily")) <= ctime("10:00 PM"))

This record meets one of those statements.
John Doe 17 Mon, 7/5/04 7/1/04 4:00pm 6

Remember with OR, as long as one of the statements is met, then the whole statement is considered true,

and your record that isn't showing up but you say should show up actually meets the criteria of being <= 10pm. So even though it isn't < 5, it does meet the other part of your OR statement and therefore is suppressed.

I think you want to use an 'AND' between those 2 statements where you currently have an 'OR'. So your rule for being in comliance would actually be:

no minor can work after 10pm AND can not have worked more than 5 hrs per day Mon-Thurs.


 
What if, instead of trying to suppress the section, you flipped the logic and only selected certain records?

In other words, you would only show records where the hours worked are >5 OR the clock out time is >10:00? That way, you could do it in the record selection rather than trying to suppress.

I always find that the suppress is sort of reverse logic and a little more difficult to do - if you can do a select and make it more straight-forward, it may be easier.
 
Thanks mrudolph, switching the OR to an AND did the trick. For this report, I needed to return all the records thus my solution was to do a suppression.

I was thinking though and will need to try it, is i could have created a variable on the GF section that set a variable to say "suppress" or "don't suppress" based on the labor logic and then did a suppression based on that value.

Thanks for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top