Absence Entry Validation Fast Formula for Checking if Leaves Applied are in Multiples of two Weeks

Business Requirement: Check if the absence entered is in multiples of Two Weeks.(Absences applied should always be in 2,4,6,.. Weeks and Not in 1,3,5,..Weeks)

Solution: Write a Global Absence Entry Validation Fast Formula and attach it to the Absence Type Maternity/Parental leave Type having Unit of Measure as Weeks. When the user applies for absence (in this case Maternity/Parental leave)for any duration other than in multiples of two weeks then the application throws a custom error message “Absence Duration must be multiples of 0.2”.


Sample Formula: Global Absence Entry Validation Fast Formula for Checking if leaves applied are in multiples of two weeks


DEFAULT for ANC_ABS_ENTRS_ABSENCE_TYPE_ID is 0
DEFAULT for ANC_ABS_ENTRS_DURATION is 0
DEFAULT for PER_ASG_STANDARD_WORKING_HOURS is 0
DEFAULT for ANC_ABS_ENTRS_ABSENCE_STATUS_CD IS ' '
DEFAULT for ANC_ABS_TYP_NAME IS ' '
DEFAULT for GLOBAL_PAY_INTERFACE_EXTRACTION_DATE IS ' '
DEFAULT for PER_ASG_FTE_VALUE is 0
DEFAULT_DATA_VALUE for ANC_PER_ABS_ENTRS_ABSENCE_ENTRY_ID_ARR is 0
DEFAULT FOR PER_ASG_EMPLOYMENT_CATEGORY IS ' '
DEFAULT FOR PER_ASG_STATUS_USER_STATUS IS ' '
DEFAULT FOR PER_ASG_ORG_LEGAL_EMPLOYER_NAME IS ' '
DEFAULT for PER_ASG_SYSTEM_PERSON_TYPE is ' '
DEFAULT FOR PER_ASG_ATTRIBUTE4 IS ' '
DEFAULT FOR PER_ASG_ATTRIBUTE2 IS ' '
DEFAULT FOR PER_ASG_ATTRIBUTE1 IS ' '
DEFAULT FOR PER_ASG_ATTRIBUTE_CATEGORY IS ' '
DEFAULT for PER_ASG_REL_ORIGINAL_DATE_OF_HIRE is '4712/12/31 00:00:00' (date)
INPUTS ARE IV_END_DATE (date), IV_START_DATE (date), IV_TOTALDURATION, Max(Number)
l_system_date = TO_DATE(GLOBAL_PAY_INTERFACE_EXTRACTION_DATE,'YYYY/MM/DD')
l_system_year = TO_NUMBER(TO_CHAR(l_system_date,'YYYY'))
l_absence_start_year = TO_NUMBER(TO_CHAR(iv_start_date,'YYYY'))
l_absence_end_year = TO_NUMBER(TO_CHAR(iv_end_date,'YYYY'))
ln_rem = MOD(IV_TOTALDURATION,0.2)
IF ( ANC_ABS_TYP_NAME = 'Maternity/Parental leave' or ANC_ABS_TYP_NAME = 'Adoption Leave')THEN
(
 IF (ln_rem = 0) then
                (
                                            VALID = 'Y'
                )
                                                               
                ELSE
                (
                                                VALID='N'
                                                ERROR_MESSAGE = 'Absence Duration must be multiples of 0.2'
                )                                             
)                                                             
Return VALID, ERROR_MESSAGE



Comments