Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 8

Calculating Seniority Dates

Using Fast Formula


Oracle Fusion Human Capital Management
ORACLE WHITE PAPER | SEPTEMBER 2018
Introduction
Fast formulas are generic expressions of calculations or comparisons that you want to repeat with different input
variables. You can use fast formula to calculate the seniority dates of a worker. This document describes the
procedure to create fast formula and lists the parameters for the Employment Seniority Date Adjustment and
Employment Seniority Hours to Days Conversion fast formula types.

Create Fast Formula


» Click Navigator > Setup and Maintenance.
» On the Tasks panel tab, click Search.
» In the search box, enter Manage Fast Formulas, and click the Search icon.
» Click the Manage Fast Formulas task name.
» In the Search Results area, click the Create icon.

» In the Create Fast Formula dialog box, do the following:


 Enter the formula name.
 Select the Employment Seniority Date Adjustment type.
 Select the effective start date.
 Click Continue.

1 | CALCULATING SENIORITY DATES USING FAST FORMULA


» Enter the fast formula logic in the Formula Text box.
Note: If you want to use database items (DBIs), search the DBI name on the Database Items tab, select the
row from the search results, and then click Add to Formula.

» Click Submit, and then click Compile to check whether the fast formula is valid.

2 | CALCULATING SENIORITY DATES USING FAST FORMULA


» Click OK, and then click Done.
» If the compile process is successful, a check icon is displayed in the search results. If the compile process
fails, check the error message for details.

Context for Employment Seniority Date Adjustment


Use the following query to list the context types for the Employment Seniority Date Adjustment formula type:

SELECT C.BASE_CONTEXT_NAME

FROM FF_FORMULA_TYPES_B T

, FF_FORMULA_TYPES_TL TTL

, FF_FTYPE_CONTEXT_USAGES U

3 | CALCULATING SENIORITY DATES USING FAST FORMULA


, FF_CONTEXTS_B C

WHERE T.FORMULA_TYPE_ID = U.FORMULA_TYPE_ID

AND TTL.FORMULA_TYPE_ID = T.FORMULA_TYPE_ID

AND T.BASE_FORMULA_TYPE_NAME = 'Employment Seniority Date Adjustment'

AND TTL.LANGUAGE = USERENV('LANG')

AND C.CONTEXT_ID = U.CONTEXT_ID

Sample Fast Formula Definition for Employment Seniority Date Adjustment


You must use the following parameters for the Employment Seniority Date Adjustment formula type.
/****************************************************************************
*
* Formula Name:
*
* Description: This formula using the following context:
* EFFECTIVE_DATE, PERSON_ID, HR_RELATIONSHIP_ID, HR_TERM_ID, HR_ASSIGNMENT_ID
*
****************************************************************************/
default for SENIORITY_ADJUST_COMMENT is 'no adjustment'
default for SENIORITY_ADJUST_IN_DAYS is 0
default for SENIORITY_ADJUST_IN_HOURS is 0
default for CUMULATIVE_FLAG is 'N'
default for SENIORITY_BASIS is 'ORA_PER_SNDT_DAYS'
default for PREVIOUS_SENIORITY_EXIT_DATE is '1900/01/01 00:00:00' (DATE)
default for BASE_SENIORITY_DATE is '1900/01/01 00:00:00' (DATE)

INPUTS ARE
EFFECTIVE_START_DATE (DATE),
EFFECTIVE_END_DATE (DATE),
SENIORITY_DATE_CODE (TEXT),
SENIORITY_BASIS (TEXT),
CUMULATIVE_FLAG (TEXT),
BASE_SENIORITY_DATE (DATE),
PREVIOUS_SENIORITY_EXIT_DATE (DATE),
SENIORITY_LEVEL_OBJECT_ID (NUMBER),
SENIORITY_TRIGGERING_FIELD_CODE (TEXT),
ACTION_CODE (TEXT),
CHANGED_VALUE_NEW (TEXT),
CHANGED_VALUE_OLD (TEXT),
SENIORITY_LEVEL_CODE (TEXT),
TOTAL_SENIORITY_HOURS (NUMBER),
PREVIOUS_TOTAL_SENIORITY_HOURS (NUMBER),
SENIORITY_DATE (DATE),
LEGALEGAL_EMPLOYER_ID (NUMBER),
LEGAL_EMPLOYER_NAME (TEXT),
ENTERPRISE_ID (NUMBER),
ENTERPRISE_NAME (TEXT),
BARGAINING_UNIT_CODE (TEXT),
BARGAINING_UNIT_NAME (TEXT),
GRADE_ID (NUMBER),
GRADE_NAME (TEXT),
GRADE_STEP_ID (NUMBER),
GRADE_STEP_NAME (TEXT),
JOB_ID (NUMBER),
JOB_NAME (TEXT),
POSITION_ID (NUMBER),
POSITION_NAME (TEXT),
UNION_ID (NUMBER),
UNION_NAME (TEXT),

4 | CALCULATING SENIORITY DATES USING FAST FORMULA


LOCATION_ID (NUMBER),
LOCATION_NAME (TEXT),
DEPARTMENT_ID (NUMBER),
DEPARTMENT_NAME (TEXT),
COLLECTIVE_AGREEMENT_ID (NUMBER),
COLLECTIVE_AGREEMENT_NAME (TEXT)

/* check if the date is passed */


EFF_DATE = EFFECTIVE_START_DATE
if PREVIOUS_SENIORITY_EXIT_DATE WAS DEFAULTED or BASE_SENIORITY_DATE WAS DEFAULTED then (
return EFF_DATE, SENIORITY_ADJUST_COMMENT, SENIORITY_ADJUST_IN_DAYS,
SENIORITY_ADJUST_IN_HOURS
)

RETURN_THRESHOLD = 6 /* month */
retain_expired = 'N'
compare_date = ADD_MONTHS(PREVIOUS_SENIORITY_EXIT_DATE, RETURN_THRESHOLD)
if EFFECTIVE_START_DATE > compare_date then (
retain_expired = 'Y'
)

if SENIORITY_BASIS = 'ORA_PER_SNDT_DAYS' then (


if CUMULATIVE_FLAG = 'Y' then (
if retain_expired = 'Y' then (
SENIORITY_ADJUST_IN_DAYS = DAYS_BETWEEN(BASE_SENIORITY_DATE, PREVIOUS_SENIORITY_EXIT_DATE)
SENIORITY_ADJUST_IN_DAYS = SENIORITY_ADJUST_IN_DAYS + 1
SENIORITY_ADJUST_COMMENT = 'Previous Seniority (' + to_char(SENIORITY_ADJUST_IN_DAYS) + '
days) is lost as the Bridging Period exceeds 6 months.'
return EFF_DATE, SENIORITY_ADJUST_COMMENT, SENIORITY_ADJUST_IN_DAYS,
SENIORITY_ADJUST_IN_HOURS
)
) else (
if retain_expired = 'N' then (
SENIORITY_ADJUST_IN_DAYS = DAYS_BETWEEN(PREVIOUS_SENIORITY_EXIT_DATE, BASE_SENIORITY_DATE)
SENIORITY_ADJUST_IN_DAYS = SENIORITY_ADJUST_IN_DAYS + 1
SENIORITY_ADJUST_COMMENT = 'Previous Seniority (' + to_char(SENIORITY_ADJUST_IN_DAYS) + '
days) is retained as the Bridging Period does not exceed 6 months.'
return EFF_DATE, SENIORITY_ADJUST_COMMENT, SENIORITY_ADJUST_IN_DAYS,
SENIORITY_ADJUST_IN_HOURS
)
)
)
if SENIORITY_BASIS = 'ORA_PER_SNDT_HOURS' then (
comment = 'TODO'
)
return EFF_DATE, SENIORITY_ADJUST_COMMENT, SENIORITY_ADJUST_IN_DAYS,
SENIORITY_ADJUST_IN_HOURS

Sample Fast Formula Definition for Employment Seniority Hours to Days


Conversion
You must use the following parameters for the Employment Seniority Hours to Days Conversion formula type.
/* default logic to 2 way conversion for Hours to YearMonthDay (YMD) and YMD to Hours
*/

default for DIRECTION is 'H2D'


INPUTS ARE
EFFECTIVE_START_DATE (DATE),
EFFECTIVE_END_DATE (DATE),
DIRECTION (TEXT),
HOURS (NUMBER),
YEARS (NUMBER),
MONTHS (NUMBER),

5 | CALCULATING SENIORITY DATES USING FAST FORMULA


DAYS (NUMBER)

if DIRECTION = 'D2H' then


(
RETURN_HOURS = YEARS*2080 + MONTHS*173 + DAYS*8
)
else
(
RETURN_YEARS = 0
RETURN_MONTHS = 0
RETURN_DAYS = 0
TMP_HOURS = HOURS
if TMP_HOURS >= 2080 then
(
RETURN_YEARS = FLOOR(TMP_HOURS/2080)
TMP_HOURS = MOD(TMP_HOURS, 2080)
)
if TMP_HOURS >= 173 then
(
RETURN_MONTHS = FLOOR(TMP_HOURS/173)
TMP_HOURS = MOD(TMP_HOURS, 173)
)
if TMP_HOURS >= 8 then
(
RETURN_DAYS = FLOOR(TMP_HOURS/8)
TMP_HOURS = MOD(TMP_HOURS, 8)
)
if TMP_HOURS > 0 then
(
RETURN_DAYS = RETURN_DAYS + 1
)
)
return
RETURN_HOURS,
RETURN_YEARS,
RETURN_MONTHS,
RETURN_DAYS

6 | CALCULATING SENIORITY DATES USING FAST FORMULA


CONNECT WITH US

blogs.oracle.com/oracle

facebook.com/oracle

twitter.com/oracle

oracle.com

Oracle Corporation, World Headquarters Worldwide Inquiries


500 Oracle Parkway Phone: +1.650.506.7000
Redwood Shores, CA 94065, USA Fax: +1.650.506.7200

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. This document is provided for information purposes only, and the
contents hereof are subject to change without notice. This document is not warranted to be error-free, nor subject to any other
warranties or conditions, whether expressed orally or implied in law, including implied warranties and conditions of merchantability or
fitness for a particular purpose. We specifically disclaim any liability with respect to this document, and no contractual obligations are
formed either directly or indirectly by this document. This document may not be reproduced or transmitted in any form or by any
means, electronic or mechanical, for any purpose, without our prior written permission.

Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.

Intel and Intel Xeon are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are used under license and
are trademarks or registered trademarks of SPARC International, Inc. AMD, Opteron, the AMD logo, and the AMD Opteron logo are
trademarks or registered trademarks of Advanced Micro Devices. UNIX is a registered trademark of The Open Group. 0918

White Paper Title: Calculating Seniority Dates Using Fast Formula


September 2018
Author: Girish Singh

CONNECT WITH US

blogs.oracle.com/oracle

facebook.com/oracle

twitter.com/oracle

oracle.com

7 | CALCULATING SENIORITY DATES USING FAST FORMULA

You might also like