CS Time/TNA Documents

username password

Testing for and creating Errors

    The Errors File

    The following information will come in handy when manipulating TNA warnings with macro scripts:


    Err:Code:  The type of error

    1 = Wrong Clocking Direction found

    2 = Employee has an invalid shift code

    3 = Shift has an invalid length

    4 = Shift has an invalid payroll length

    5 = Employee did not clock out by "Must be out by" time

    6 = Missing Daily Hours Record

    7 = Shift has an invalid holiday shift code

    8 = Employee is missing an out clocking

    9 = Shift has timeslots missing for a day

    10 = Imported leave - existing daily hours

    Err:Date: The date of the error.

    Err:Other:  Other information regarding the warning e.g. the time the employee was expected to clock OUT at or the date on which the error occured.

    Err:Time:  The time that the error occurred - normally the actual clocking time.

    Err:Type: The type of error:

    D = Daily Hours error. I.e. the error was generated while processing daily hours.

    P = Payroll Hours error. I.e. the error was generated while processing payroll hours.

    Testing for a Specific Error

    If you want to test for a specific error e.g. where the employee did not clock out, your script may look like this:


    At Error

    if err:code = 5

       Put the rest of your code here.



    Ignoring an Error

    To ignore a error i.e. to not write the error to file.


    At Error

    if err:code = 5

       IgnoreError = 1



    The above script will ignore the "Employee did not clock out by" error.


    Creating a Custom Error

    To create a custom error you need to use the WriteError function.  In the example below we are testing for cases where a) there are only 2 clockings for the shift and b) the employee clocked in and out within one minute.  The we are creating a custom error with the description of "Duplicate clockings".


    At Before Saving Daily Hours

    if numclockings = 2
       if LastClockingTime - FirstClockingTime < 0:01
          WriteError(100,'Duplicate Clockings',FirstClockingTime,'D')


    Permalink:  http://tinyurl.com/6r4rufv

    Page last modified 10:00, 9 Feb 2012 by Careen CS Time/TNA Documents > Macro Scripts > Examples > Testing for and creating Errors


    You must login to post a comment.
    Attach file


    Powered by MindTouch Core