Home      Ask a Question      My Stuff      Help   
  
Scripting - Having a Category Persist

This process allows a category to persist even if the employee clocks OUT then back IN from lunch.

In our example we will be dictating what the category is based on if their first punch of the day falls on, or between 5:00am and the IN time is less than 8:00am. If so we will change the category to "Shift 1" and add an amount of 1 to the numeric prompt of "shift":

if (isfirsttoday AND intime >= 5:00am AND intime < 8:00am) {
category = "Shift 1"; shift = 1;}

The numeric prompt "shift" records an amount that we can reference on any punch during a single day using a "reporitngdate.totalday" script regardless of if they clock OUT then back IN say for a lunch or break.

Now to reference our "1" so that the category "Shift 1" persists. See below:

if (reportingdate.totalday ("shift") = 1) {
category = "Shift 1";}

This states that if the total amount of our numeric prompt "shift" is "1" then change the category to "Shift 1". As we are only changing the numeric prompt to "1" initially for that first punch of the day the amount should persist as "1" for that whole day it is created on.

Here is the combined scripts:

if (isfirsttoday AND intime >= 5:00am AND intime < 8:00am) {
category = "Shift 1"; shift = 1;}

if (reportingdate.totalday ("shift") = 1) {
category = "Shift 1";}



The last part would be to create the numeric clock prompt. You will do so by creating a "Web only (Numeric)" under Prompt Assignment with the below values:

Data Collection Mode: Show online, but do not collect anything
Name of the field: shift
Visible/Editable: Not Visible, Not Editable
What type of numbers should we collect from employees? Whole numbers only, no decimals.

The other fields can remain blank or at their default settings.
ID
1488
Category
>Support
  Scripting
Date Created
3/27/2015 7:25:13 AM
Date Updated
3/27/2015 7:55:42 AM
Back to Search Results