Wednesday, November 14, 2012

How is the personal work schedule id derived?

Work Schedules play a central role in both PeopleSoft Absence Management and Time and Labor. Work Schedules can be assigned directly to an employee and there are the following assignment methods possible:
1. Assign a pre-defined work schedule
2. Inherit a default work schedule. If you are interested to know how the default work schedule is decided, read this post.
3.  Assign a personal schedule. A personal schedule gives the user flexibility to define a work schedule pattern that is specific to one assignment of an employee.

When you define a personal work schedule, the schedule id is automatically derived by PeopleSoft and is non-editable.

The figure above, clearly illustrates that when an assignment method of personal schedule is selected, the schedule id is defaulted and greyed out.
So, what is the logic used by the system to derive the schedule id?
The system uses a combination of Employee Id and Employee Record number to derive the personal schedule id. This is done so that it will enable users to create unique personal schedule for different assignments of an employee id. The personal schedule id is derived by concatenating the employee id to a five digit number derived by adding the employee record number to 100000.
The code used to come up with the personal schedule id is given below:

EMPLID | Substring(String(100000 + EMPL_RCD), 2, 5);

The code can be interpreted as a two step process:
The first step is to derive the last five digits of the personal schedule id. This is done by first adding the employee record number to the numeral 100000. The first five digits starting from the second digit of the result is then retrieved. This new five digit number is concatenated to the employee id to derive the personal schedule id.
Let us sign off this post with an example.
What would be the personal schedule id of an employee with employee id 100000345 and employee record number 3?
Step 1:
Add employee record number to 100000. This results in 100003
Retrieve the last five digits of the schedule id by substringing the above result. So, the last five digits of the schedule id will be 00003.

Step 2:
Concatenate the final result from Step 1 with the employee id to have the personal schedule id.
This will result in a personal schedule id of 10000034500003

No comments: