LogoSupport Hub

WorkSync Evening Shifts Processing Module

This processing module extracts and formats evening shift data for use in WorkSync reports. It serves as a building block component that can be integrated into larger WorkSync report systems, focusing specifically on afternoon/evening shift processing logic.

Parameters

  • @MIN - Start date for the report (example: '9/1/2022')
  • @MAX - End date for the report (example: '9/1/2022')

Data Components

The module consists of 1 focused processing section:

  1. Evening Shifts Processing - Covers shifts from 14:00:00 to 18:59:00

Features include:

  • Scheduled employees for evening shifts
  • Open evening shifts from unfulfilled schedules
  • Zone-based organization using Work Group 5
  • DENSE_RANK ordering for consistent numbering

Output Format

Simple evening shift data extraction:

ColumnDescription
ZoneZone name (formatted from WG5)
PositionPosition title from Work Group 3
schdateSchedule date
shifttimeFormatted shift time (Start - End)
empnameEmployee name or "OPEN SHIFT"
numeroDense rank number for ordering

Technical Implementation

The script uses:

  • Single time range filtering (14:00:00 to 18:59:00)
  • Zone filtering using @WESTBloom table variable
  • UNION ALL operations to combine scheduled and open shifts
  • DENSE_RANK() function for consistent ordering without gaps
  • Time formatting using RIGHT and CONVERT functions
  • Work Group 5 zone organization

Zone Configuration

Standard WorkSync zone configuration:

  • Zone numbers: 2, 4, 5, 6, 7, 12, 29
  • Zone name formatting: SUBSTRING(wg5.NAME,4,30)

Key Features

  • DENSE_RANK Usage - Provides consecutive numbering without gaps
  • Afternoon Focus - Specifically targets afternoon/evening operations
  • Standard Integration - Compatible with all WorkSync report variations
  • Simple Logic - Straightforward time range without midnight complications

Use Cases

  • Modular Evening Shift Processing - Reusable component for evening shift data
  • Integration Component - Building block for larger WorkSync reports
  • Evening Shift Analysis - Standalone evening shift data extraction
  • Shift Transition Planning - Focus on afternoon-to-evening transitions
  • Custom Report Building - Foundation for custom evening shift reports

Integration with Other Reports

This processing module is used by:

Benefits

  • Reusable Logic - Consistent evening shift processing across reports
  • Modular Design - Can be integrated into various report structures
  • Simple Time Logic - No midnight spanning complications
  • Standardized Output - Consistent data format for integration
  • Dense Ranking - Consecutive numbering for better organization

Comparison with Other Shift Modules

  • Simpler than Night Shifts - No midnight spanning logic required
  • Similar to Day Shifts - Straightforward time range processing
  • DENSE_RANK vs ROW_NUMBER - Different ranking approach than other modules

T-SQL

worksync_schedules_report_v3_evening_shifts.sql
DECLARE @MIN DATE, @MAX DATE, @ZoneCount int, @Row int
SET @MIN='9/1/2022'
SET @MAX='9/1/2022'

DECLARE	@WESTBloom Table(Num smallint)
insert into @WESTBloom(Num) Values (2),(4),(5),(6),(7),(12),(29)
;

With Evenings as (
select Substring(t.wg5,4,30) as Zone, t.wg3 as Position,t.schdate as schdate,t.shifttime as shifttime,t.empname as empname,DENSE_RANK() over (order by t.wg5, t.wg3)as numero
from 
(
select distinct wg5.NAME as wg5, wg3.NAME as wg3,
sch.schdate as schdate,
Right(convert(varchar(20),sch.starttime,100),7)+' - '+ Right(convert(varchar(20),sch.endtime,100),7) as shifttime,
e.firstname+' '+e.lastname as empname
from schedules sch
inner join employees e
on e.filekey = sch.filekey
inner join WORKGROUP5 wg5
on wg5.WGNUM = sch.WG5
inner join workgroup3 wg3
on wg3.wgnum = sch.wg3
where convert(time,sch.starttime) between '14:00:00' and '18:59:00'
and sch.schdate between @min and @max
and sch.wg1 = 9
and sch.WG5 in (select num from @WESTBloom)
and sch.schtype in (0)

union all

select distinct wg5.NAME as wg5, wg3.NAME as wg3,
sch.schdate as schdate,
Right(convert(varchar(20),sch.mindate,100),7)+' - '+ Right(convert(varchar(20),sch.maxdate,100),7) as shifttime,
'OPEN SHIFT' as empname
from unfulfilledschs sch
inner join WORKGROUP5 wg5
on wg5.WGNUM = sch.WG5
inner join workgroup3 wg3
on wg3.wgnum = sch.wg3
where convert(time,sch.mindate) between '14:00:00' and '18:59:00'
and sch.schdate between @min and @max
and sch.wg1 = 9
and sch.WG5 in (select num from @WESTBloom)
and sch.schtype in (0)

)t
)

Select * from Evenings

Content Inventory

  • Doc File: content/docs/reports/worksync/worksync_evening_shifts_processing.mdx
  • SQL Script: SQL/reports/worksync/riverview_version_of_worksync_sechedule_report.sql