isfirsttoday and islasttoday Scripting Keyword

These two keywords look for exactly what it says. They are test conditions to test for the first punch of the day (ISFIRSTTODAY)and the last punch of the day (ISLASTTODAY). They are useful in having a script run only once per day on punched times.

This keyword operates the same in TimeWorks as TimeWorksPlus.

An example of how you could apply this keyword would be if an employee works from 9am to 5pm. They also clock out for breaks. In this example, everything after 5pm would be OT. Now you want to
  • test to see if the last punch of the day for any employee was after 5:00pm
  • and if so, add an alert stating they clocked out late.

You could use the "ISLASTTODAY" script like below:

if (islasttoday){
    if (outtime > 5:00pm){
         addalert("Employee Clocked Out Late");

This script checks if it's the last punch of the day. If it is, then it checks to see if the outtime is greater than 5pm. If that is also yes, an alert is added to the time card.

Note, in TimeWorks, there is no addalert keyword, but you could use exception " Employee Clocked Out Late"; in its place.

You can also script for punches that are not the first or last of the day by checking for a false statement like the below example:

if (isfirsttoday = false){
        if (outtime > 11:00am) {
             addalert("Employee Left Late For Lunch");

So in this example the employee is supposed to clock out for lunch before 11:00am, but if he/she does not he gets the alert "Employee Left Late For Lunch".

Did you find this article helpful?