Skip to main content
All CollectionsAttendanceAttendance Data
Attendance Functions Calculation-Built-in Functions Tutorial
Attendance Functions Calculation-Built-in Functions Tutorial

Don’t know how to add a new attendance item formula? Here to find what you need ,you can apply immediately!

Workstem CS avatar
Written by Workstem CS
Updated over 2 years ago

1. Take the absolute value

Formula: Abs(Expression)


Function: return to the absolute value of Expression
Expression: numeric type, the value to be calculated; the name or value of the calculation item of the numeric type can be passed in.
Example: value = Abs(-5), the calculation result is 5.

2. Get employee information

Formula: GetEmployeeInfo(fieldName)


Function: get the value of the employee information (numeric, date, text, etc.)
Expression:
fieldName:the column name of the employee’s properties interface
Example: GetEmployeeInfo('entryDate')

3. Get the attendance date

Formula:AttendDay()


Function: get the attendance date of the current computed row record
Expression:null
Example: var a = AttendDay() the return result is 2021-11-10

4. Get the work type

Formula:CalendarWorkDays()


Function: get the work type of holiday calendar
No parameter
Example:
var a = CalendarWorkDays()
if ( a == 'PH'){ value = 4 }
if (a == 'SH'){value = 3}
if ( a == 'rest'){value = 2}
if ( a == 'normal' ){value = 1}
else value = 0

5. Round up

Formula: Ceil(Expression, digits)


Function: round up
Expression: numeric type, the value to be calculated; the name or value of the calculation item of the numeric type can be passed in.
digits: numeric type, reserved decimal place (can be defaulted; the default value is 0)
Example 1: value = Ceil(5.42), the calculation result is 6.
Example 2: value = Ceil(1.352, 2) , the calculation result is 1.36.

6. Get the attendance clock in time

Formula: ClockIn()

Function : get the employee's attendance clock in time of the current day
Parameter Description: None
Function Description: get the employee's attendance clock in time of the current day
Return value: yyyy-mm-dd HH: mm: SS.
Example: var a = ClockIn()

7. Get attendance clock off time

Formula: ClockOff()

Function : get the employee's attendance clock out time of the current day
Parameter Description: None
Function Description: get the employee's attendance clock out time of the current day
Return value: yyyy-mm-dd HH: mm: SS.
Example: var a = ClockOff ()

8. Date and time concatenation

Formula:Convert(Expression1, Expression2)


Function: date and time concatenation
Expression 1: date and time
Example: var a= Convert( ShiftIn() ,'2022-01-02 01:01:01')

9. Get the start or end date of the current attendance calculation cycle

Formula:CycleBeginOrEnd(Type)


Function: get the start or end date of the current attendance calculation cycle
Expression:
Type: the value is STAR/END
Example:
var a =DateAdd(day,0, CycleBeginOrEnd('START') )
value = Day(a)

10. Add or subtract time intervals from specified dates

Formula:DateAdd(DatePart, Number, Expression)


Function: add or subtract time intervals from specified dates
DatePart: can be YEAR/MONTH/DAY
Number: numeric type, the added number of years or months or days;
Expression: date type/project
The return value: a new date
Example:
var a = DateAdd(YEAR, 2, '2001-01-01') the return value is 2003-01-01
var a = DateAdd(MONTH, 2, '2001-01-01') the return value is 2001-03-01
var a = DateAdd(DAY, 2, '2001-01-01') the return value is 2001-01-03

11. Compare date

Formula:DateDiff(Type, Expression1, Expression2)


Function: return to the the amount of time between two dates to be compared;
Type:YEAR/MONTH/DAY/hour/min
Expression 1: character/date type
Expression 2: character/date type
Example: value = DateDiff( hour, GetToday() , '2025-01-01 10:35:24')

12. Get date and time

Formula:DateTimePart(Type, Expression)


Function: return to the hour/minute of the date
Type:Type can be HOUR/MIN
Expression: date-time type, time format:'yyyy-MM-dd HH:mm'
Example:
value = DateTimePart(HOUR, '2020-02-02 09:00') the return value is 9
value = DateTimePart(MIN, '2020-02-02 09:10') the return value is 10

13. Take the day

Formula:Day(Expression)


Function: the return value is numeric and return to the day corresponding to the current date;
Expression:character type/date type, current date value (format YYYY-MM-DD); You can pass in a project of character type, the result is a specific date, if the argument is null or an empty string, the result is the day of the current date of the system.
Example: value = Day( GetToday() )

14. Round down

Formula: Floor(Expression, digits)


Function: round down
Expression:numeric type, the value to be calculated; the name or value of the calculation item of the numeric type can be passed in.
digits: numeric type, must be accurate to the decimal place; input digits.
Example 1:value = Floor(1.352), the calculation result is 1.
Example 2:value = Floor(1.3567, 2), the calculation result is 1.35.
Example 3:value = Floor(-5.42), the calculation result is -6.

15. Get multi-segment detailed information of attendance scheduling punch card

Function name: GetAttendanceInfo(fieldName, index)

Function description: Get multi-segment detailed information of attendance scheduling punch card
Expression:
fieldName: clockin、clockout、shiftin、shiftout、mealtime、mealstarttime、mealendtime
index: The first paragraph of the multi-segment, int, the default value is 1
Example:
var a = GetAttendanceInfo('clockin', 2) // Return to the second period of clock-in time
var b = GetAttendanceInfo('mealtime', 1) // Return to the length of the meal for the shift

16. Return to the current date

Formula:GetToday()


Function: return to the current date
Expression:
Example: var a = GetToday()

17. When the expression NULL is encountered, return the specified string

Formula:IfNull()


Function: when NULL is encountered, return to the specified string
Expression:
Example:
var vPosition = GetEmployeeInfo('positionName')
var a= IfNull(vPosition, 'test')

18.Get the result of the intersection matching between the leave application and the time period of scheduling

Formula:IntersectTimeForLeaveBill()


Function: get the result of the intersection matching between the leave application and the time period of scheduling
Expression: null
Example: value = IntersectTimeForLeaveBill()

19. Get the result after the overtime request is matched with the actual punch-in data

Formula:IntersectTimeForLeaveBill()


Function: get the result of the intersection matching between the leave application and the time period of scheduling
Expression: null
Example: value = IntersectTimeForLeaveBill()

20. Get the result of matching the ot application form with the actual clock-in/out data

Formula:IntersectTimeForOtBill()


Function: get the result of matching the ot application form with the actual clock-in/out data
Expression: null
Example: value = IntersectTimeForOtBill(),the return result is 60min

21. Return to the larger one of the two numbers to be compared

Formula: Max(item1, item2)


Function: return to the larger one of the two numbers to be compared
item1: numeric type, value 1 to be compared; the name or value of the calculation item of the numeric type can be passed in.
Item2: numeric type, value 2 to be compared; the name or value of the calculation item of the numeric type can be passed in.
Example: value = Max(5.4,5.7), the calculation result is 5.7.

22. Return to the smaller one of the two numbers to be compared

Formula: Min(item1, item2)


Function: return to the smaller one of the two numbers to be compared
item1: numeric type, value 1 to be compared; the name or value of the calculation item of the numeric type can be passed in.
Item2: numeric type, value 2 to be compared; the name or value of the calculation item of the numeric type can be passed in.
Example: value = Max(5.4,5.7), the calculation result is 5.4.

23. Return to the month of the date

Formula:Month(Expression)


Function: return to the month of the date;
Expression:character type/date type, projects of numeric type can be passed in
Example: value = Month( '2001-07-18'), the return result is 7

24. Digit to string

Formula:NumToStr(Expression)


Function: digit to string;
Expression:numeric type, the value to be calculated; items of numeric type can be passed in.
Example 1: var a = NumToStr(2001.0), the return value is'2001';
Example 2: var a = NumToStr(3.5), the return value is '3.5'.

25. Get the latest clock-in/out of the last day’s calculation

Formula:PreviousDayLastCard(Type)


Function: get the latest clock-in/out of the last day’s calculation
Expression:
Type:'TIME’/'DATETIME'
Example:
1、var a = PreviousDayLastCard() or
var a = PreviousDayLastCard('TIME') the return result is '18:01'
2、var a = PreviousDayLastCard('DATETIME') the return result is '2020-11-10 18:10'

26. Round up/down

Formula: Round(Expression, digits)


Function: round up/down
Expression:numeric type, the value to be calculated; the name or value of the calculation item of the numeric type can be passed in.
digits: numeric type, must be accurate to the decimal place; input digits.
Example 1:value = Round(5.42, 1), the calculation result is 5.4.
Example 2:value = Round(-5.56), the calculation result is -6.

27. Get the date type of the schedule

Formula:ScheduleDayType()


Function: get the date type of the schedule
Example:value = ScheduleDayType()
Working days or no schedule: 0
Rest days: 1
Statutory: 2

28. Get the day's shift schedule

Formula: ShiftIn()

Function name: get the employee attendance details and the scheduled working time of the current day
Parameter Description: None
Function Description: get the working time of employee attendance details, and return null if there is no shift arrangement
Return value: YYYY-MM-DD HH:MM:SS.
Example: var a = ShiftIn()

29. Get current shift name

Formula: ShiftName()


Function: Get the name of daily attendance details shift template
Expression: Null
Example: var a = ShiftName()

30 . Get the day's shift off-duty time

Formula: ShiftOff()

Function name: get the employee attendance details, shift scheduling and off-duty time of the current day
Parameter Description: None
Function Description: get the working time of employee attendance details, and return null if there is no shift arrangement
Return value: YYYY-MM-DD HH:MM:SS.
Example: var a = ShiftOff ()

31. String-to-digital

Formula: StrToNum(Expression)


Function: string to digit
Expression: a character type project or string to be processed
Example 1: value = StrToNum('2001'), the return value is2001.0;
Example 2: var a = 6018.8, value =StrToNum(a) , the return value is 6018.8.

32. String interception

Formula: Substring(Expression, start, end)


Function: string interception
Expression: string or date
start: numeric type, the character sequence number at the beginning of the substring (counting from 1);
end: numeric type, the number of characters in the substring.
Example: var vPosition = Substring(‘advanced manager’,3,4), the return result is ‘manager’.

33. Get the number of hours of the timesheet

Formula:TimesheetHours('Type')


Function: get the number of hours of the timesheet
Expression:
Type: the value is 'OT1'or'OT2'or'OT3'or'NORMAL'
Example: value = TimesheetHours('OT1') +TimesheetHours('Normal') +TimesheetHours('OT2') +TimesheetHours('OT3')

34. Get the type of timesheet

Formula:TimesheetInfo(Type)


Function: return to the type of the timesheet
Expression:
Type:the value is ’Location‘、’Project‘
Example:
var a = TimesheetInfo('Location')
if ( a =='HK' ) {
value = 200
}
else {
value = 0
}

35. Return to the start/end time of the timesheet

Formula:TimesheetTime(Type, Index)


Function: return to the start/end time of the timesheet
Expression:Type:START/END ;Index:Type:START/END ;Index:indicate which page of the timesheets
Example:
var a = TimesheetTime( 'StartTime', 1)
var b= TimesheetTime( 'EndTime', 1)
value = DateDiff(min ,a ,b)

34. Count the number of timesheets of different types

Formula:Timesheetcount(Type)


Function: count the number of timesheets of different types
Expression:
Type: character type, the value is 'OT1'or'OT2'or'OT3'or'NORMAL'
Example: value = Timesheetcount('OT1') the return value is 2

36. Take the week corresponding to the attendance date currently being calculated

Formula:Weekday(Expression)


Function: take the week corresponding to the attendance date currently being calculated
Expression: character/date /project type
Example: value = Weekday( AttendDay())

37. Get the year of the date

Formula:Year(Expression)


Function: return to the year of the date;
Expression:character type/date type,
Example: value = Year( '2001-07-18'), the return result is 2001

Did this answer your question?