Home      Ask a Question      My Stuff      Help   
  
Scripting - Scripting Off of the "Start Date" Field in Employee Setup
This article goes over how to script against a date in the "Start Date" field in Employee Setup. This can be used to count how many days an employee has been employed and if it goes beyond a certain point makes him eligible for certain benefits like say going from a probationary period to full time worker.

The script is done in two parts one to do the calculation and an if statement to get a true or false statement based on the calculation.

Below is the script for the calculation portion:

amount = punchdate - startdate;

This creates a variable "amount" (but you can name it what ever you want) which equals to "punchdate" or the date of the punch in question minus "startdate" or the "Start Date" field in Employee Setup. So for example if their start date was 2/1/2010 and they had a punch on 2/5/2010 the value of "amount" would be 4.

Below is an example if statement to get a true or false statement based on the calculation:

if (amount >= 90)

This states based on you "amount" calculation if the value of "amount" is greater or equal to 90 then do something. If not ignore.

So here is another example:

amount = punchdate - startdate;

if (amount >= 90)
{
if (isholiday and category = "Regular" and istimes)
{
category = "Holiday Worked";
}}

So in the example:

1. If the calculation for "amount" as we explained before hand is greater or equal to 90 (days).
2. If the day is a holiday (isholiday)
3. If they did punch in for this day (istimes).
4. If the punch was originally job code/category "Regular".

Then

Change the category/job code to "Holiday Worked".

If not ignore the script.
ID
525
Category
Training
  FAQ's
Date Created
2/22/2011 2:34:29 PM
Date Updated
2/24/2011 11:01:02 AM
Back to Search Results