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

Return only the first work week

Status
Not open for further replies.

n2nuk

IS-IT--Management
Dec 24, 2002
190
GB
I am working on a HR report where i need to return a work pattern for each employee. A work pattern is the number of hours worked for each employee. As we have part time workers it is possible for an employee to work monday, tuesday and thursday.
When a new employee starts they are a allocated an existing working pattern that fits their hours and days or a new working pattern is created for them. When a work pattern is created the HR system generates the days they will be working upto a data in the future.
For example, Sally who started working with our organisation on the 8th of August works Tuesday, Wednesday and Friday only. Her work pattern would look like this

WorkPatternDate -- Hours
08/08/2016 -- 0
09/08/2016 -- 7.2
10/08/2016 -- 7.2
11/08/2016 -- 0
12/08/2016 -- 3.2
13/08/2016 -- 0
14/08/2016 -- 0

This is repeated for each day until a date in the future. My report is returning a row for everyday upto the end date. this is returning thousands of rows when what i want is to return the first week only. How can i do this?

the fields I have are
workpattern_ref
Workpattern_date
workpattern_hours
workpattern_name



 
This is not a particularly efficient approach as it still need to pull back all records so it can establish the first date for each person. It also assumes you have it grouped by {Table.workpattern_name} but it should work. Place the following code into the Group Selection Formula:

Code:
{Table.workpatten_date} < (MINIMUM({Table.workpatten_date}, {Table.workpattern_name})) + 7

If tis is still too slow, let me know what the data source is as it might be possible to use a SQL Expression or Command to improve efficiency.

Hope it helps.

Cheers
Pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top