Home      Ask a Question      My Stuff      Help   
  
TimeWorksPlus: Scripting Keywords
The following are keywords in the scripting engine of TimeWorksPlus. Most are able to be used in all scripting boxes, which can be accessed through Processing Rules, but there are some that will only work in certain script boxes

Global
¯¯¯¯¯¯
- Employee (accessed through 'employee.NAME')
    - yearsofservice (a decimal number)
- monthsofservice (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)
    - birthday (returns a whole number on the anniversary date of the employees birthday)
    - title
    - firstname
    - lastname
    - code
    - designation
    - startdate
    - enddate
    - department
    - location
    - supervisor
    - home1
    - home2
    - home3
    - autolunchhours
    - lunchminutes
    - accrualfactor
    - employeetype
    - accrualvalidator (employee field when BasicAccruals rule is activated)
- employee.maxhours (Max Hours Weekly field for the HoursAlert rule)

- Defined Operators
    and • boolean operator
    or • boolean operator
    - • subtract operator
    + • addition operator
    * • multiply operator
    /, \ • divide operator, the / is a decimal division and the \ is an integer division
    %, mod • modulus operator, this returns the remainder of an integer division. 11.5 mod 5 = 1.5
    >, >= • greater than, greater than or equal to
    <, <= • less than, less than or equal to
    <> • does not equal
    contains • checks to see if the string contains another string
    startswith • checks to see if the string starts with a particular string
    endswith • checks to see if the string ends with a particular string

- Defined Variables
    - hours = hours worked
    - minutes = minutes worked
    - seconds = seconds worked
    - breakseconds = break time in seconds
    - minutesout = amount of time elapsed between the current in punch to the previous out punch
        -minutesout(false) = same as above but include seconds in the form of decimal minutes i.e. 30 minutes and 15 seconds is displayed as "30.25".
    - minutestil = amount of time elapsed between the current out punch to the next in punch
    - punchset = the is times punch set number
    - category = the category of the punch
    - punchdate = date of the punch
    - intime = the time of the clock in punch
    - outtime = the time of the clock out punch
    - inismissing = false if the intime is not missing
    - outismissing = false if the outtime is not missing
    - istimes = true if there are times
    - ishours = true if only hours
    - ispayonly = true if dollars only
    - inisedited = true if intime was edited
    - outisedited = true if outtime was edited
    - hourstopunch = hours previous to the punch in question on that day
    - hourstopunchot = hours previous to the punch in question on that day that are overtime eligible
    - linetonow = the amount of seconds from the last punch to what it is right now (up to an 18 hour limit)
    - inip = the IP address of the in punch
    - outip = the IP address of the out punch

- Defined Functions
     - within     (ex. within( department , "100|110|200|210" ) = TRUE)
         - returns true or false
     - translate     (ex. translate( department , "100|110|200|210", "Warehouse,Shipping,Accounting,Billing,Office" ))
         - changes the selected item from one value to another
     - dateadd      (ex. dateadd("mm", 6, employee.startdate))
         - returns a date
     - dateserial      (ex. dateserial(reportingdate.year,12,31))
         - returns a date
     - weekday      (ex. weekday(punchdate))
         - returns the weekday of the date, MTWRFSU
     - len      (ex. len("this is the best")) 16
         - returns the length of the string or amount of characters
     - left      (ex. left("this is the best",4)) "this"
         - returns the first amount of characters in a string of characters
     - right      (ex. right("this is the best",4)) "best"
         - returns the last amount of characters in a string of characters
     - mid      (ex. mid("this is the best",6,2)) "is"
         - returns the characters starting at the 6th, and takes two characters
     - val      (ex. val("5.555")) 5.555
         - returns a number instead of a string
     - cint      (ex. cint("5.555")) 5
         - returns an integer instead of a string or decimal number
     - cstr      (ex. cstr(5.555)) "5.555"
         - returns a string instead of a number, date, time, or datetime
     - cdate      (ex. cdate("2014-11-25")) 2014-11-25
         - returns a date instead of a string
     - cdatetime      (ex. cdatetime("2014-11-25 08:00:00")) 2014-11-25 08:00:00
         - returns a datetime instead of a string
     - ctime      (ex. ctime(indt)) 17:00:00
         - returns a time instead of a datetime
     - round      (ex. round("7:45am-8:00am=8:00am"))
         - rounds the time up or down
     - abs      (ex. abs(-5)) 5
         - returns a positive number
     - addalert      (ex. addalert("Late"))
         - adds an alert to the time card
     - unpay      (ex. unpay(hours))
         - sets the amount defined in hours to unpaid.
     - touches      (ex. touches(6:00am,3:00pm))
         - returns true or false if punch set touches specified time
     - overlaps
         - returns true or false if punch set overlaps specified time
     - day
          -returns the day of the date object
     - month
          -returns the month of the date object
     - year
          -returns the year of the date object
    - isedited
        - returns true if the string property given was edited for a particular punch

OTThresholdScript
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
     - ot1threshold = weekly overtime threshold
     - ot2threshold = weekly doubletime threshold
     - ot1daythreshold = daily overtime threshold
     - ot2daythreshold = daily doubletime threshold
     - otrules = one of the rules found in the overtime category of processing rules (for example: CA, NV, NO) ( ex. otrules("CA") )

RoundScript
¯¯¯¯¯¯¯¯¯¯¯¯
- round
- roundin
- roundout
- roundends

SplitScript
¯¯¯¯¯¯¯¯¯¯
- split      (ex. split(12:00am))
     - splits a punch at the specified time

ReportingDateScript
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
- tomorrow     (ex. tomorrow(0))
     - pushes the punch to the next day
- yesterday     (ex. yesterday(0))
     - pushes the punch to the previous day

AddEntryScript
¯¯¯¯¯¯¯¯¯¯¯¯¯
- addentry("type", amount, "category") (ex. addentry("hours", 8, "Regular"))
     - adds a time card entry to the time card

PayrateScript
¯¯¯¯¯¯¯¯¯¯¯¯¯
- payrate
- isfirsttoday
- islasttoday
- Reportingdate. (Can also be used in the Accrual script boxes)
     - date
     - todaysdate = today's date (real time)
     - year
     - month
     - weekday
     - isfirstdayofmonth = Returns True on the first day of the month.
     - islastdayofmonth = Returns True on the last day of the month.
     - payperiodstart = Returns the date of the First day of the pay period.
     - payperiodend = Returns the date of the Last day of the pay period.
     - isholiday = Returns TRUE if the date is a holiday.
     - spread = returns the amount of time between the first in punch and the last out punch in a day, returns as a timespan. To get it as hours, use the following: val(reportingdate.spread) / 3600
     - totalhours = hours in the day
     - totalhoursot = hours in the day that are overtime eligible
     - hourstodate = hours to date in the week
     - hourstodateot = hourstodate in the week that are overtime eligible
     - weekhours = hours in the week
     - pphours = hours in the pay period
     - islastpunchpp = last punch date of the pay period
     - islastpunchweek = last punch date of the week
     - totalweek = returns the amounts in both numeric prompts and dollar amounts in the work week
     - totalpp = returns the amounts in both numeric prompts and dollar amounts in the pay period
     - totalday = returns the amounts in both numeric prompts and dollar amounts on the day of the punch
     - punchsets = returns how many punch sets are in the day
     - depthours = returns the amount of hours allocated to a particular labor prompt with a particular value in a day. (reportingdate.depthours("FieldNameOfLaborPrompt", "ValueOfLaborPrompt");)
     - schedhours = returns the amount of scheduled hours in the day. Can take an integer that specifies which scheduled line to get the hours from(reportingdate.schedhours(punchset);)
     - schedlines = returns the total amount of scheduled lines in the day (reportingdate.schedlines;)
     - schedin = returns the in time of the first scheduled line. Can take an integer that specifies which scheduled line to get the in time from (reportingdate.schedin(punchset);)
     - schedout = returns the out time of the first scheduled line. Can take an integer that specifies which scheduled line to get the out time from (reportingdate.schedout(punchset);)
     - schedplace = returns the place of the first scheduled line. Can take an integer that specifies which scheduled line to get the place from (reportingdate.schedplace(punchset);)
     - workweekend = Returns the date of the last day of the Work Week.

AccrueUpScript/AccrueDownScript
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
- accrueup     (ex. accrueup("PTO", 4, 160))
    - Accrues up the specified amount of hours in the chosen bucket
    - Has 5 arguments: Bucket Name, amount, maximum cap, vesting date, expiration date.
- accruedown    (ex. accruedown("PTO", hours))
    - Accrues down the specified amount of hours in the chosen bucket
    - Has 3 arguments: Bucket Name, amount, minimum for bucket.
- getbalance     (ex. getbalance("Hours"))
    - returns the number of hours in the bucket
- setbalance     (ex. setbalance("Hours",0))
    - sets the balance of the bucket to the number you place after the comma

For a document that is easier to read and has more information about scripting, click here: TimeWorksPlus Scripting.docx
ID
803
Category
>Support
  Scripting
Date Created
12/28/2012 10:27:44 AM
Date Updated
4/13/2020 1:34:32 PM
Back to Search Results