The default Fast Formula uses the Fast Formula functions xxas_calculate_absence_duration_days or xxas_calculate_absence_duration_hours to calculate duration:
If Hours_or_Days = 'H' Then ( /* Calculate the duration hours using standard Oracle functionality */ Calculated_Duration = xxas_calculate_absence_duration_hours (Absence_Type_Id_Value_in, Date_Start_Value_in, Date_End_Value_in ,Time_Start_Value_in, Time_End_Value_in) ) Else ( /* Calculate the duration hours using standard Oracle functionality */ Calculated_Duration = xxas_calculate_absence_duration_days (Absence_Type_Id_Value_in, Date_Start_Value_in, Date_End_Value_in) )
These functions use the standard Oracle rules to calculate duration:
- If Work Schedules are configured, it calculates the duration using the defined work schedules
- If the BG_ABSENCE_DURATION Fast Formula is defined, it calculates the duration by calling this formula
- If neither of the above is used, it uses simple calculations to work out the elapsed duration between the given dates/times.
Some organizations use a feature of the BG_ABSENCE_DURATION formula to return an error message based on custom validation rules. This is fully supported; in this case, you use a different formula function called xxas_calculate_absence_duration_full. Here's an example of its use, where the custom error messages are presented to the user:
Absence_Days_Output = 0 Absence_Hours_Output = 0 Use_Formula_Output = 0 Min_Max_Failure_Output = 'Unknown' Warning_or_Error_Output = 'Unknown' Page_Error_Msg_Output = 'Unknown' /* Calculate the duration using the Full function */ Duration_Func_Rslt = xxas_calculate_absence_duration_full (Absence_Type_Id_Value_in, Date_Start_Value_in, Date_End_Value_in, '00:00', '23:59', Absence_Days_Output, Absence_Hours_Output, Use_Formula_Output, Min_Max_Failure_Output, Warning_or_Error_Output, Page_Error_Msg_Output) If IsNull(Page_Error_Msg_Output) != 'Y' Then ( Absence_Type_Id_description = '<font color = "#FF4000">Error: ' + Page_Error_Msg_Output + '</font>' /* Blank out the end date so the absence cannot be saved without correction */ Date_End_Value = '4712-01-01 00:00:00' (date) )