Home      Ask a Question      My Stuff      Help   
  
TimeWorks/TimeWorks Plus Scripting - Creating a Script that is Assigned (Employee Setup)
-- TIMEWORKS
__________________________________________________________________________________________

Scripting can be assigned select employees or a group of employees. In most cases this can be done with having it assigned to select fields in Employee Setup. The fields that can be assigned as identifiers in TimeWorks for a script are:

1. Department
2. Location
3. Supervisor
4. Home 1, Home 2, and Home 3

below is an example script that will take the "Location" field from Employee Setup and map it to a clock prompt by taking the "if (location = "100")" and the x = "100". An example of this is below:

if (Location = "100")
{
x = "100";
}

You could also narrow it down to a single employee by adding the employee's name in question (John Smith) to the "Home 1" field in Employee Setup and if this is met it will give him a payrate of $8.00 in our below example:

if(home1 = "John Smith")
{
payrate = 8.00;
}

You can also do it to trigger other type scripts like rounding rules. The below changes the rounding rule based on "100" in the "Home 1" field in Employee Setup to round to the nearest 5 minutes on all punches:

if (Home1 = "100")
{
round("N5");
}

Variations can also be done with this using clock prompts. In the below examples we will use the x prompt in conjunction with our department field in Employee Setup:

A very basic script using this is below:

x = supervisor;

It simply states show what is in the "Supervisor" field in Employee Setup in the x prompt on the employees time card.

A benefit of using this variation with clock prompts is that it is dynamic as the employee at the clock has control over what he enters at the x prompt. The below example script says if what the employee enters at the clock prompt x matches his "Department" field in Employee Setup give him the amount in "Alt Pay Rate 2" in Employee Setup.

if (x = department)
{
payrate = payrate2;
}





-- TIMEWORKS PLUS
__________________________________________________________________________________________

The fields that can be assigned as identifiers in TimeWorks Plus for a script are different in that you will add "employee." to the front of each field you are referencing. There are also more available fields to reference:


Employee.(accessed through 'employee.NAME')

NAMES:
- yearsofservice (a decimal number)
- daysofservice (a decimal number)
- anniversary (returns a whole number on the anniversary date of the employee)
- monthiversary (returns a whole number on the anniversary date of the employee)
- title
- firstname
- lastname
- code
- designation
- startdate
- enddate
- department
- location
- supervisor
- home1
- home2
- home3
- autolunchhours
- lunchminutes

An example of what a script would look like in TWP is:


if (employee.home1 = "100")
{
round("N5");
}

When scripting using a clock prompt in TWP, you will use the "Field Name" of the prompt rather than the actual prompt you set up (ie. I, J, K, X, Y, Z). Let's use the example from above using the x prompt in conjunction with our department field in Employee Setup. Let's say that we named the x prompt "Supervisor". It would look like so:

Supervisor = employee.supervisor;

It simply states show what is in the "Supervisor" field in Employee Setup in the x prompt on the employees time card.

If you are referencing a clock prompt named the same as an employee setup field (ie. Department, Location or Supervisor), you would use the prompt name when referencing the prompt and "employee." when referencing employee setup. If we set up a location prompt and we want it to enter the employees home location if the employee leaves the prompt blank then we would create the prompt and use the following script:

if(Location = ""){
Location = employee.location;
}

This will fill the prompt with whatever is in their home location field.

if(job = "100")
{
payrate = 8.00;
}

The above adds a pay rate based on a clock prompt with the field name of "job". If the employee enters in "100" at that clock prompt it will reassign the pay rate to $8.00.



ID
347
Category
<Unassigned>
Date Created
1/12/2009 10:02:20 AM
Date Updated
5/7/2015 10:32:50 AM
Back to Search Results