Oracle Fast Formulas - Chapter 30: Writing Fast Formulas for Absence Management

 

Chapter 30: Writing Fast Formulas for Absence Management


Oracle Fusion Absence Management allows organizations to define, track, and manage employee leaves. Fast Formulas play a key role in validating, calculating, and restricting leave entries based on business rules.

This chapter explains how to write Fast Formulas for various absence scenarios, such as validation, accrual, and duration calculations.


🔹 Types of Absence Fast Formulas

TypePurpose
Absence ValidationValidates if a leave can be applied based on rules
Accrual MatrixDefines rules to calculate earned leave based on criteria
Accrual PlanCalculates how much leave is accrued over time
Duration FormulaCalculates leave duration between start and end dates
Entitlement FormulaModifies the entitlement based on conditions

📘 Example: Absence Validation Formula

This formula ensures that employees can't apply for more than 2 consecutive casual leaves.

plsql
INPUTS ARE ABSENCE_DAYS_NUMBER, ABSENCE_TYPE DEFAULT FOR ABSENCE_DAYS_NUMBER IS 0 DEFAULT FOR ABSENCE_TYPE IS 'NA' IF ABSENCE_TYPE = 'Casual Leave' AND ABSENCE_DAYS_NUMBER > 2 THEN RETURN 'You can apply for maximum 2 days of Casual Leave only.' ELSE RETURN '' ENDIF

🧠 This formula prevents invalid leave submission during entry.


📘 Example: Accrual Formula (Based on Service Period)

plsql
INPUTS ARE YEARS_OF_SERVICE DEFAULT FOR YEARS_OF_SERVICE IS 0 IF YEARS_OF_SERVICE >= 10 THEN ACCRUAL_DAYS = 24 ELSIF YEARS_OF_SERVICE >= 5 THEN ACCRUAL_DAYS = 18 ELSE ACCRUAL_DAYS = 12 ENDIF RETURN ACCRUAL_DAYS

📘 Example: Duration Calculation Formula

You can calculate actual absence days by excluding weekends.

plsql
INPUTS ARE START_DATE, END_DATE, WEEKEND_COUNT DEFAULT FOR START_DATE IS '1900/01/01' DEFAULT FOR END_DATE IS '1900/01/01' DEFAULT FOR WEEKEND_COUNT IS 0 DURATION = DAYS_BETWEEN(START_DATE, END_DATE) + 1 - WEEKEND_COUNT RETURN DURATION

🧠 Best Practices

Tip #Recommendation
1Use proper DEFAULT values for all inputs
2Validate edge cases like negative days or nulls
3Avoid hardcoding dates or values
4Always return appropriate messages for validations
5Test with different input data in test mode

📝 Common DBIs in Absence Formulas

DBI NameDescription
PER_ASG_ABSENCE_TYPEAbsence type for employee
PER_ABS_START_DATEStart date of leave
PER_ABS_END_DATEEnd date of leave
PER_ABS_DAYSTotal leave days
PER_YEARS_OF_SERVICEEmployee's total service years

📚 Mini Quiz

1. What is the use of an Absence Validation Formula?
a) To calculate salary
b) To prevent invalid leave applications
c) To assign a job role
d) To change grade

Answer: b) To prevent invalid leave applications

2. Which function calculates date difference?
a) DATE_SUBTRACT
b) DATEDIFF
c) DAYS_BETWEEN
d) GET_DAYS

Answer: c) DAYS_BETWEEN

No comments:

Post a Comment