Monday, February 29, 2016

Fast Formula – Compensation Example



Fast Formula – Compensation- A Real Life Scenario Example

In previous sections, we went over the basics of the Fast Formula, input values and return values of Fast Formula of Compensation product.
In this session, we will create our first real life Fast Formula for Compensation Formula Type, Compensation Default and Override (for CWB) and Total Compensation Item (for TCS).
To write such a Fast Formula, we need to have a real life use case. Therefore, we have taken a hypothetical case which very closes resembles a real life scenario and we will write a Fast Formula for Compensation Default and Override (CWB) and Total Compensation Item (TCS) with a little difference.
Use Case:
  • We need to calculate the salary of an employee.
  • The salary frequency is Monthly.
  • We need to calculate the salary as of the first date of every month.
  • The salary needs to be calculated for every month within the Plan/Statement Periods.
  • We do not need to calculate the salary for the month if the first date of the month is not part of the period. For example, we do not calculate for January 2015 if the period start date is 10-January-2015.
  • We do need to calculate the salary for the month if the start date of the month is before the period end date. For example, we will calculate for December 2015 if the period end date is 20-December-2015.
  • If there is FTE (Full Time Equivalent Factor), we need to consider the FTE. For example, FTE .5 when a person works for 4 hours a day and the standard working hours are 8 per day.
  • The salary could be defined in different frequencies. For example, Monthly, Yearly or Daily.   But the salary period is always defined as monthly. Therefore in this example, we will the Annual Salary for calculation.
  • Compensation Default and Override (for CWB):  For CWB, in this example, we need to sum the amounts for the Plan Period and return one value. In case the salary amount has different currencies for the Plan Period , we do not calculate the sum but return -1.
  • Total Compensation Item (for TCS): For TCS, In this example, we need to return the Salary value for every month. Since the value is returning on a monthly basis, we do not worry about the currency in Fast Formula.  
The following is our analysis before we start writing the formula:
  1. We need the start and end date of the Period (Input Values)
  2. We need to ascertain the start date of the period.  If the start date is not the first of the month, we need to calculate the salary from the first date of the next month.
  3. We need to find the DBI for Annual Salary, Currency and FTE.
  4. From the Annual salary, we need to derive the monthly salary.
Once we have the above information, we do the following:
  • We loop through the dates from the start date to the end date of the period.
  • We calculate the First date by using Add_Months Function.
  • Within the loop, we set the effective date context to the first date of the month.
  • We get the salary from Annual Salary DBI and divide the amount by 12 to get the monthly salary.
  • If the FTE DBI value is not 1, then we multiply the salary amount with the FTE to derive the monthly average salary.
  • For CWB, we calculate the sum of the monthly values. For TCS , we append the monthly values with a delimiter ‘;’.
CWB FORMULA:
/*
 Author  : Tilak
 Type    : Compensation Default and Override
 NAME    :   MY_FIRST_CWB_DEFAULT_FF
 Remarks: This is a first simple formula to explain the functionality of a Fast Formula. This does not have an advanced feature.


 Requirement: Calculate the sum of the salary as of the first date of the month within the period.


 DBI used:    CMP_ASSIGNMENT_SALARY_ANNUAL_AMOUNT
              CMP_ASSIGNMENT_SALARY_CURRENCY_CODE
              PER_ASG_FTE_VALUE
*/


/*
Declare the DBI
*/
DEFAULT FOR  CMP_ASSIGNMENT_SALARY_ANNUAL_AMOUNT IS 0
DEFAULT FOR  PER_ASG_FTE_VALUE IS 1
DEFAULT FOR  CMP_ASSIGNMENT_SALARY_CURRENCY_CODE IS 'XYZ'


/*
Declare the Input Values
*/
INPUTS ARE CMP_IV_PLAN_START_DATE (text), CMP_IV_PLAN_END_DATE (text)


l_hr_assign_id = get_context(HR_ASSIGNMENT_ID, -1)
L_DATA = ESS_LOG_WRITE( 'BEGIN MY_FIRST_CWB_DEFAULT_FF' )
L_DATA = ESS_LOG_WRITE( 'Start Date :' + CMP_IV_PLAN_START_DATE)
L_DATA = ESS_LOG_WRITE( 'End Date   :' + CMP_IV_PLAN_END_DATE)
L_DATA = ESS_LOG_WRITE( 'Asg ID     :' + TO_CHAR(l_hr_assign_id))


L_PL_START_DATE      = TO_DATE(CMP_IV_PLAN_START_DATE,'YYYY/MM/DD')
L_PL_END_DATE        = TO_DATE(CMP_IV_PLAN_END_DATE,'YYYY/MM/DD')
L_VALUE              =  0
l_CURR               =  ' '


/*
Determine the First date
*/
IF (L_PL_START_DATE <> ROUND(L_PL_START_DATE, 'MM')) THEN
(
  L_PL_START_DATE = TRUNC(ADD_MONTHS(L_PL_START_DATE, 1), 'MM')
  L_DATA = ESS_LOG_WRITE( 'New Start Date      :' + TO_CHAR( L_PL_START_DATE,'YYYY/MM/DD'))
  L_DATA = ESS_LOG_WRITE( 'New End Date      :' + TO_CHAR( L_PL_END_DATE,'YYYY/MM/DD'))  
)


WHILE (L_PL_START_DATE <= L_PL_END_DATE)
LOOP(
  L_DATA = ESS_LOG_WRITE( 'New Start Date in Loop     :' + TO_CHAR( L_PL_START_DATE,'YYYY/MM/DD'))
 CHANGE_CONTEXTS(EFFECTIVE_DATE = L_PL_START_DATE)
 (
   L_DATA = ESS_LOG_WRITE( 'Salary      :' + TO_CHAR( CMP_ASSIGNMENT_SALARY_ANNUAL_AMOUNT ))
   IF (CMP_ASSIGNMENT_SALARY_ANNUAL_AMOUNT WAS NOT DEFAULTED ) THEN
   (
     L_AMOUNT  =  CMP_ASSIGNMENT_SALARY_ANNUAL_AMOUNT
      L_DATA = ESS_LOG_WRITE( 'Annual Salary      :' + TO_CHAR(L_AMOUNT))
      L_DATA = ESS_LOG_WRITE( 'FTE      :' + TO_CHAR(PER_ASG_FTE_VALUE))
      L_DATA = ESS_LOG_WRITE( 'CURRENCY      :' + CMP_ASSIGNMENT_SALARY_CURRENCY_CODE)


     IF (PER_ASG_FTE_VALUE WAS NOT DEFAULTED) THEN
     (
        L_AMOUNT  =  CMP_ASSIGNMENT_SALARY_ANNUAL_AMOUNT * PER_ASG_FTE_VALUE
      )
      IF (l_CURR =  ' ') THEN
      (
         L_CURR = CMP_ASSIGNMENT_SALARY_CURRENCY_CODE
      )       
      IF ( L_CURR = CMP_ASSIGNMENT_SALARY_CURRENCY_CODE) THEN
      (
        L_VALUE = L_VALUE +  (L_AMOUNT/12)
        L_DATA = ESS_LOG_WRITE( 'CALC VALUE      :' + TO_CHAR(L_VALUE))
      )ELSE  
      (
        L_DATA = ESS_LOG_WRITE( 'CURRENCY MIS MATCH      :' )
       L_VALUE       = -1
      Exit
       )
      


   )
   
 )
 L_PL_START_DATE = ADD_MONTHS(L_PL_START_DATE, 1)
)


L_DATA = ESS_LOG_WRITE( 'END MY_FIRST_CWB_DEFAULT_FF' )  
RETURN  L_VALUE       


Explanation of the Fast Formula:
Once we determine the DBI, we need to declare and assign a default value to the DBI.  Since the Fast Formula does not support null values, we need to define the default value for the DBI in case it returns a null value to avoid any unknown issues.
         /*
            Declare the inputs and DBI
*/
DEFAULT FOR CMP_ASSIGNMENT_SALARY_ANNUAL_AMOUNT IS 0
We can also check the DBI value is null or not null using the syntax ‘WAS DEFAULTED’ and ‘WAS NOT DEFAULTED’.
Once the DBI is declared, we need to declare the Input Values.
We need to understand the type of input values passed. Some developers also default the Input Values. The product documentation provides the information about the input values and its types. Since this Fast Formula is attached to the formula type, Compensation Default and Override, we can see the input values passed to this one from section 3 under Input Values. We declare the CWB dates as text but in TCS we declare them as date.
INPUTS ARE CMP_IV_PLAN_START_DATE (text), CMP_IV_PLAN_END_DATE (text)
For this example, we have explained the main points of the business logic below.
  • We determine if the start date of the plan is the start of the month and if not, we change the start date to the beginning of next month.
/*
Determine the Start Date
*/
IF (L_PL_START_DATE <> ROUND(L_PL_START_DATE, 'MM')) THEN
(
..
..
)
  • We go through the loop for each month
WHILE (L_PL_START_DATE <= L_PL_END_DATE)
LOOP (
  L_DATA = ESS_LOG_WRITE( 'New Start Date in Loop     :' + TO_CHAR( L_PL_START_DATE,'YYYY/MM/DD'))


  • We change the context to the beginning of the month using CHANGE_CONTEXTS. When we change the context, the DBI values are extracted as of the new context value.  The change context takes effect only within the brackets.
 CHANGE_CONTEXTS(EFFECTIVE_DATE = L_PL_START_DATE)
 (
   ……
   ……
   ……
)


And we get the salary amount using the DBI, CMP_ASSIGNMENT_SALARY_ANNUAL_AMOUNT.


 CHANGE_CONTEXTS(EFFECTIVE_DATE = L_PL_START_DATE)
 (
   L_DATA = ESS_LOG_WRITE( 'Salary      :' + TO_CHAR( CMP_ASSIGNMENT_SALARY_ANNUAL_AMOUNT ))
   IF (CMP_ASSIGNMENT_SALARY_ANNUAL_AMOUNT WAS NOT DEFAULTED) THEN
   (
      L_AMOUNT  =  CMP_ASSIGNMENT_SALARY_ANNUAL_AMOUNT
      L_DATA = ESS_LOG_WRITE( 'Annual Salary      :' + TO_CHAR(L_AMOUNT))
      L_DATA = ESS_LOG_WRITE( 'FTE      :' + TO_CHAR(PER_ASG_FTE_VALUE))
      L_DATA = ESS_LOG_WRITE( 'CURRENCY      :' + CMP_ASSIGNMENT_SALARY_CURRENCY_CODE)


  • We check if the DBI, PER_ASG_FTE_VALUE has a null value (WAS NOT DEFAULTED) and if not null, we use this value to calculate the salary.


     IF (PER_ASG_FTE_VALUE WAS NOT DEFAULTED) THEN
     (
        L_AMOUNT  =  CMP_ASSIGNMENT_SALARY_ANNUAL_AMOUNT * PER_ASG_FTE_VALUE
      )


  • We check if the currency of the monthly salary amounts is same. If so, we calculate the sum of these values. Otherwise, we set the value to -1 and exit the loop.
      IF (l_CURR =  ' ') THEN
      (
         L_CURR = CMP_ASSIGNMENT_SALARY_CURRENCY_CODE
      )       
      IF ( L_CURR = CMP_ASSIGNMENT_SALARY_CURRENCY_CODE) THEN
      (
        L_VALUE = L_VALUE +  (L_AMOUNT/12)
        L_DATA = ESS_LOG_WRITE( 'CALC VALUE      :' + TO_CHAR(L_VALUE))
      )ELSE  
      (
        L_DATA = ESS_LOG_WRITE( 'CURRENCY MIS MATCH      :' )
       L_VALUE       = -1
      Exit
       )
   )
 )
  • We set the start date to the next month and continue the loop till the period end date.
 L_PL_START_DATE = ADD_MONTHS(L_PL_START_DATE, 1)
)


The most important part is logging (debugging) the Fast Formula. You should try to add as much debug data as needed in the log. Once you feel the Fast Formula is working fine, you can comment them out. There are different logging mechanisms available: ESS_LOG_WRITE, HRTRACE etc. If the Formula is processed in ESS, we recommend using ESS_LOG_WRITE().
L_DATA = ESS_LOG_WRITE( 'BEGIN MY_FIRST_CWB_DEFAULT_FF' )
The final part is the return value. As we explained in the previous section, you must know what the Fast Formula is expected to return. From section 3, we know it can be any variable  for Compensation Default and Override Formula type.
RETURN  L_VALUE       
Once the CWB Fast Formula has been compiled successfully, you can attach the Fast Formula to the Attribute Column property.



You can process the CWB Plan in Compensation -> Run Batch Process -> Start Workforce Compensation Cycle.  Once the process is completed successfully, you can see the log messages in Compensation -> Run Batch Process -> Monitor process -> Log and output (Navigation may vary from release to release). By checking the log, you can easily debug the Fast Formula.  
The sample of log message from this process is given below:


TCS Formula:
/*
 Author  : Tilak
 Type    : Total Compensation Item
 NAME    :   MY_FIRST_TCS_ITEM_FF
 Remarks: This is a first simple formula to explain the functionality of Formula. This does not have an advanced feature.


 Requirement: Calculate the Salary as of first date of the months within the period and sum the salary.


 DBI used:    CMP_ASSIGNMENT_SALARY_ANNUAL_AMOUNT
              CMP_ASSIGNMENT_SALARY_CURRENCY_CODE
              PER_ASG_FTE_VALUE
*/


/*Declare the inputs and DBI */
DEFAULT FOR  CMP_ASSIGNMENT_SALARY_ANNUAL_AMOUNT IS 0
DEFAULT FOR  PER_ASG_FTE_VALUE IS 1
DEFAULT FOR  CMP_ASSIGNMENT_SALARY_CURRENCY_CODE IS 'XYZ'


INPUTS ARE CMP_IV_PERIOD_START_DATE (DATE) ,CMP_IV_PERIOD_END_DATE (DATE)


L_DATA = ESS_LOG_WRITE( 'BEGIN MY_FIRST_TCS_ITEM_FF' )


L_PL_START_DATE      = CMP_IV_PERIOD_START_DATE
L_PL_END_DATE        = CMP_IV_PERIOD_END_DATE


l_hr_assign_id = get_context(HR_ASSIGNMENT_ID, -1)
L_DATA = ESS_LOG_WRITE( 'Start Date   :' + TO_CHAR( L_PL_START_DATE,'YYYY/MM/DD'))
L_DATA = ESS_LOG_WRITE( 'END Date   :' + TO_CHAR( L_PL_END_DATE,'YYYY/MM/DD'))


L_DATA = ESS_LOG_WRITE( 'Asg ID     :' + TO_CHAR(l_hr_assign_id))


L_DATA = ESS_LOG_WRITE( ' start of Date Conversion')


COMPENSATION_DATES   =  ' '
VALUES               =  ' '
l_CURR               =  ' '
L_DATA = ESS_LOG_WRITE( ' Determine the First date')
/*Determine the First date*/
IF (L_PL_START_DATE <> ROUND(L_PL_START_DATE, 'MM')) THEN
(
  L_PL_START_DATE = TRUNC(ADD_MONTHS(L_PL_START_DATE, 1), 'MM')
  L_DATA = ESS_LOG_WRITE( 'New Start Date      :' + TO_CHAR( L_PL_START_DATE,'YYYY/MM/DD'))


)
L_DATA = ESS_LOG_WRITE( ' start of Date Loop')
WHILE (L_PL_START_DATE <= L_PL_END_DATE)
LOOP(
 L_DATA = ESS_LOG_WRITE( 'New Start Date   in loop    :' + TO_CHAR( L_PL_START_DATE,'YYYY/MM/DD'))


 CHANGE_CONTEXTS(EFFECTIVE_DATE = L_PL_START_DATE)
 (
  L_DATA = ESS_LOG_WRITE( 'ANN SALARY   :' + TO_CHAR( CMP_ASSIGNMENT_SALARY_ANNUAL_AMOUNT))
   IF (CMP_ASSIGNMENT_SALARY_ANNUAL_AMOUNT WAS NOT DEFAULTED ) THEN
   (
     L_AMOUNT  =  CMP_ASSIGNMENT_SALARY_ANNUAL_AMOUNT
      L_DATA = ESS_LOG_WRITE( 'Annual Salary      :' + TO_CHAR(L_AMOUNT))
      L_DATA = ESS_LOG_WRITE( 'FTE      :' + TO_CHAR(PER_ASG_FTE_VALUE))
      L_DATA = ESS_LOG_WRITE( 'CURRENCY      :' + CMP_ASSIGNMENT_SALARY_CURRENCY_CODE)


     IF (PER_ASG_FTE_VALUE WAS NOT DEFAULTED) THEN
     (
        L_AMOUNT  =  CMP_ASSIGNMENT_SALARY_ANNUAL_AMOUNT * PER_ASG_FTE_VALUE
      )
      IF (l_CURR =  ' ') THEN
      (
         L_CURR = CMP_ASSIGNMENT_SALARY_CURRENCY_CODE
      )       
      IF ( L_CURR = CMP_ASSIGNMENT_SALARY_CURRENCY_CODE) THEN
      (
        COMPENSATION_DATES   =   COMPENSATION_DATES + to_char(L_PL_START_DATE, 'YYYY/MM/DD') + ';'
         VALUES              =   VALUES + TO_CHAR(L_AMOUNT/12) + ';'
        L_DATA = ESS_LOG_WRITE( 'CALC VALUE      :' + TO_CHAR(L_AMOUNT))
      )ELSE  
      (
        L_DATA = ESS_LOG_WRITE( 'CURRENCY MIS MATCH      :' )
       )
      


   )
   
 )
 L_PL_START_DATE = ADD_MONTHS(L_PL_START_DATE, 1)
)


L_DATA = ESS_LOG_WRITE( 'END MY_FIRST_TCS_ITEM_FF' )  
RETURN  COMPENSATION_DATES ,VALUES


Total Compensation Item Fast Formula is added to the Total Compensation Item, when the Item type is Formula.



We can see the input values passed to this Fast Formula from section 3, under heading, Input Values. We declare the TCS period dates as Date because the value to the Input Value is passed in canonical format.
INPUTS ARE CMP_IV_PERIOD_START_DATE (DATE) ,CMP_IV_PERIOD_END_DATE (DATE)
Also, you can notice from the TCS Fast Formula that the return variables are defined as  “COMPENSATION_DATES” and  “VALUES”   and the values are added with delimiter, ‘;’ and the date values are added in YYYY/MM/DD format.
IF ( L_CURR = CMP_ASSIGNMENT_SALARY_CURRENCY_CODE) THEN
      (
        COMPENSATION_DATES   =   COMPENSATION_DATES + to_char(L_PL_START_DATE, 'YYYY/MM/DD') + ';'
         VALUES              =   VALUES + TO_CHAR(L_AMOUNT/12) + ';'
        L_DATA = ESS_LOG_WRITE( 'CALC VALUE      :' + TO_CHAR(L_AMOUNT))
      )ELSE  

RETURN  COMPENSATION_DATES ,VALUES


You may not be able to see the logs in the TCS Monitor page. Instead, you can see the logs of the TCS process from the CWB Monitor Page.
The sample of TCS log message from this process is given below:



Hope this has helped you with an understanding of a simple Fast Formula. We will go over more complex issues in the next section.




TCS Eligibility Fast Formula
Compensation You Tube Tutorial

/*

 Name: TCS_ELIG_FROMULA

Type:  Participation and Rate Eligibility

*/




DEFAULT FOR PER_ASG_REL_ORIGINAL_DATE_OF_HIRE is '2000/01/01' (date)

DEFAULT FOR GLOBAL_PAY_INTERFACE_EXTRACTION_DATE is '2000/01/01' 


l_temp = ESS_LOG_WRITE('Entering TCS_ELIG_FROMULA')

ELIGIBLE = 'N' 

personid      = get_Context(PERSON_ID, -1) 

assignmentid  = get_context(HR_ASSIGNMENT_ID , -1) 


l_temp = ESS_LOG_WRITE('Person ' + to_char(personid) )

l_temp = ESS_LOG_WRITE('assignmentid ' + to_char(assignmentid) ) 


today = TO_DATE(GLOBAL_PAY_INTERFACE_EXTRACTION_DATE, 'YYYY/MM/DD') 

doj    = PER_ASG_REL_ORIGINAL_DATE_OF_HIRE

l_temp = ESS_LOG_WRITE('Today  ' + to_char(Today) )

l_temp = ESS_LOG_WRITE('hire date ' + to_char(doj ) ) 

daydiff = DAYS_BETWEEN (today , doj) 

l_temp = ESS_LOG_WRITE('daydiff ' + to_char(daydiff ) ) 

if daydiff > ( 365 * 5) then (

   ELIGIBLE = 'Y'

) 




l_temp = ESS_LOG_WRITE('Leaving TCS_ELIG_FROMULA : ' + ELIGIBLE)

RETURN ELIGIBLE



128 comments:

  1. Hi !
    This all is very good.
    But how can we pull in Compensation Default and Override FF, a Payroll Element Entry Value from a Recurring element. Supposing that the Target Bonus Amount is a value stored at employee level and is updated annually ( march ) after the current year bonus calculation, to be read for the next cycle.

    Regards,
    Gabriela

    ReplyDelete
  2. Since the payroll Element Entry DBI are Legislative Data Group specific(LDG), the formula needs to be attached to an LDG.
    In case if you have more than one LDG in your employees, you need to use parent and child concept (pls see the parent and child blog).

    The element entry DBI uses the following Contexts.
    By manipulating the value of the context (Change_contexts) you get the value you like. Hope this answers your question.

    1) DATE_EARNED
    2) PAYROLL_RELATIONSHIP_ID
    or
    1) DATE_EARNED
    2) PAYROLL_ASSIGNMENT_ID

    ReplyDelete
  3. Hello Thanks for the nice blog.

    Bonus plan we need to get employees bonus eligible days in year, eligibility to bonus will be an Element entry. Eligible days need to be calculated even for inactive assignments in case of global transfers within performance year.
    Say for an employee who is having 3 global transfers in a year all assignments need to be looped to get the eligibility flag from Element entry and calculate the eligible days.

    We have a Parent FF "XXGEN_BONUS_ELIG_DAYS" of type Compensation Default and Override - non LDG specific and is attached to in compensation worksheet column. Child FF "XXGEN_GET_BONUS_FLAG" of type Compensation Default and Override but created in each LDG.

    Parent Formula is calling child FF as expected for the first assignment in loop. Where else for the second assignment it is giving the below error

    CMP_CWB_PARTI_PROCESS_PKG.get_attribute_value-Secondary
    DEFAULT VALUE RULE ERROR: 300000041393617
    ASSIGNMENT ID: 300000041392130
    ITEM NAME: CustomSegment16
    ERROR: ORA-01403: no data found
    ORA-01403: no data found
    EFFECTIVE_DATE: 2016-08-01
    PAYROLL_ASSIGNMENT_ID: 300000041392131
    LEGISLATIVE_DATA_GROUP_ID: 300000003764038

    Though we have called the Child FF with different HR_ASSIGNMENT_ID, PAYROLL_RELATIONSHIP_ID & PAYROLL_ASSIGNMENT_ID by changing the context.

    ReplyDelete
    Replies
    1. I think I know the issue. Just to make sure what I am assuming is right, can pls provide me the parent formula. If u think you can not post ur Formula in the blog. Post the formula then edit and delete the formula. I will get the information in the mail while u r posting.

      Delete
  4. Thanks for the response, Unable to Post Complete FF so posting in pieces...


    ------------------ Parent FF -----------------------

    /* ---------------------------------------------------------------------------------------------------------------------------
    ********************************************************************************************
    * NAME : XXGEN_BONUS_ELIG_DAYS
    * TYPE : Compensation Default and Override
    * Requirement: Calculate Number of days employee eligible for bonus
    * Global transfers to included that happens only if it is within the Plan cycle period
    ********************************************************************************************
    ---------------------------------------------------------------------------------------------------------------------------*/

    DEFAULT FOR PER_ASG_REL_DATE_START IS '1950/01/01 12:00:00' (date)
    DEFAULT FOR PER_ASG_REL_ACTUAL_TERMINATION_DATE IS '1950/01/01 12:00:00' (date)
    DEFAULT FOR PER_ASG_ASSIGNMENT_NUMBER IS ' '
    DEFAULT FOR ASG_HR_ASG_ID IS -1
    DEFAULT_DATA_VALUE FOR PAYROLL_ASSIGNED_EMPLOYEE_PAYROLL_ASSIGNMENT_ID IS -1
    DEFAULT_DATA_VALUE FOR PAYROLL_ASSIGNED_EMPLOYEE_PAYROLL_RELATIONSHIP_ID IS -1
    DEFAULT_DATA_VALUE FOR PAYROLL_ASSIGNED_EMPLOYEE_HR_ASSIGNMENT_ID IS -1
    DEFAULT_DATA_VALUE FOR PAYROLL_ASSIGNED_EMPLOYEE_PAYROLL_RELATIONSHIP_NUMBER IS 'NULL'
    DEFAULT_DATA_VALUE FOR PER_HIST_ASG_PERSON_ID IS -1

    DEFAULT_DATA_VALUE FOR PER_HIST_ASG_PRIMARY_WORK_REL_FLAG IS 'NULL'
    DEFAULT_DATA_VALUE FOR PER_HIST_ASG_ASSIGNMENT_TYPE IS 'NULL'
    DEFAULT_DATA_VALUE FOR PER_HIST_ASG_PRIMARY_ASG_FLAG IS 'NULL'
    DEFAULT_DATA_VALUE FOR PER_HIST_ASG_EFFECTIVE_LATEST_CHANGE IS 'NULL'
    DEFAULT_DATA_VALUE FOR PER_HIST_ASG_STATUS_CODE IS 'NULL'
    DEFAULT_DATA_VALUE FOR PER_HIST_ASG_ASSIGNMENT_ID IS -1
    DEFAULT_DATA_VALUE FOR PER_HIST_ASG_PAY_RELATIONSHIP_ID IS -1
    DEFAULT_DATA_VALUE FOR PER_HIST_ASG_REL_ACTUAL_TERM_DATE IS '1950/01/01 12:00:00' (date)


    DEFAULT_DATA_VALUE FOR PAYROLL_ASSIGNED_EMPLOYEE_HR_ASSIGNMENT_ID IS -1
    DEFAULT_DATA_VALUE FOR PAYROLL_ASSIGNED_EMPLOYEE_HR_TERM_ID IS -1
    DEFAULT_DATA_VALUE FOR PAYROLL_ASSIGNED_EMPLOYEE_PAYROLL_ASSIGNMENT_ID IS -1
    DEFAULT_DATA_VALUE FOR PAYROLL_ASSIGNED_EMPLOYEE_PAYROLL_ID IS -1
    DEFAULT_DATA_VALUE FOR PAYROLL_ASSIGNED_EMPLOYEE_PAYROLL_RELATIONSHIP_ID IS -1
    DEFAULT_DATA_VALUE FOR PAYROLL_ASSIGNED_EMPLOYEE_PAYROLL_STAT_UNIT_ID IS -1
    DEFAULT_DATA_VALUE FOR PAYROLL_ASSIGNED_EMPLOYEE_PAYROLL_TERM_ID IS -1
    DEFAULT_DATA_VALUE FOR PAYROLL_ASSIGNED_EMPLOYEE_PERSON_ID IS -1
    DEFAULT_DATA_VALUE FOR PAYROLL_ASSIGNED_LEGAL_EMPLOYER_ID IS -1
    DEFAULT_DATA_VALUE FOR PAYROLL_ASSIGNED_LEGISLATIVE_DATA_GROUP_ID IS -1

    ReplyDelete
  5. INPUTS ARE CMP_IV_PLAN_START_DATE (text) ,CMP_IV_PLAN_END_DATE (text)
    DEFAULT FOR CMP_IV_PLAN_START_DATE IS '2001/01/01'
    DEFAULT FOR CMP_IV_PLAN_END_DATE IS '4712/01/01'

    RET = ESS_LOG_WRITE( '************** Begin Get Eligible Days **************')

    l_review_start_date = TO_DATE(CMP_IV_PLAN_START_DATE,'YYYY/MM/DD')
    l_review_end_date = TO_DATE(CMP_IV_PLAN_END_DATE,'YYYY/MM/DD')

    L_DATA_TYPE = 'NUMBER'

    l_total_bonus_elig_days = 0
    l_bonus_eligibility = 'X0X0'

    nc = PER_HIST_ASG_ASSIGNMENT_ID.LAST(-1234)
    WHILE PER_HIST_ASG_ASSIGNMENT_ID.exists(nc)
    LOOP
    (
    IF PER_HIST_ASG_PRIMARY_WORK_REL_FLAG[nc] = 'Y' AND PER_HIST_ASG_ASSIGNMENT_TYPE[nc] = 'E' AND PER_HIST_ASG_PRIMARY_ASG_FLAG[nc] = 'Y' AND PER_HIST_ASG_EFFECTIVE_LATEST_CHANGE[nc] = 'Y'
    THEN
    (
    CHANGE_CONTEXTS(HR_ASSIGNMENT_ID = PER_HIST_ASG_ASSIGNMENT_ID[nc])
    (
    RET = ESS_LOG_WRITE(' Looped in Assignment ID ' + TO_CHAR(PER_HIST_ASG_ASSIGNMENT_ID[nc]) + ' Assignment Number ' + PER_ASG_ASSIGNMENT_NUMBER + ' Status ' + PER_HIST_ASG_STATUS_CODE[nc])
    IF PER_ASG_REL_ACTUAL_TERMINATION_DATE WAS DEFAULTED
    THEN
    (
    /* Logic for Active Assignment */
    l_asg_start_date = GREATEST(l_review_start_date, PER_ASG_REL_DATE_START)
    l_asg_end_date = l_review_end_date
    L_PAYROLL_ASG_ID = GET_CONTEXT(PAYROLL_ASSIGNMENT_ID,-1)
    RET = ESS_LOG_WRITE(' Running Payroll Assignment ID by Get Context : ' + TO_CHAR(L_PAYROLL_ASG_ID))
    )

    IF PER_ASG_REL_ACTUAL_TERMINATION_DATE WAS NOT DEFAULTED
    THEN
    (
    /* Logic for Inactive Assignment */
    l_asg_start_date = GREATEST(l_review_start_date, PER_ASG_REL_DATE_START)
    l_asg_end_date = PER_ASG_REL_ACTUAL_TERMINATION_DATE

    CHANGE_CONTEXTS(PAYROLL_RELATIONSHIP_ID = PER_HIST_ASG_PAY_RELATIONSHIP_ID[nc], PERSON_ID = PER_HIST_ASG_PERSON_ID[nc], HR_ASSIGNMENT_ID = PER_HIST_ASG_ASSIGNMENT_ID[nc] )
    (
    l_count = PAYROLL_ASSIGNED_EMPLOYEE_HR_ASSIGNMENT_ID.COUNT
    RET = ESS_LOG_WRITE(' l_count :' +to_char(l_count))
    nd = PAYROLL_ASSIGNED_EMPLOYEE_HR_ASSIGNMENT_ID.FIRST(-1234)
    WHILE PAYROLL_ASSIGNED_EMPLOYEE_HR_ASSIGNMENT_ID.EXISTS(nd)
    LOOP
    ( RET = ESS_LOG_WRITE( ' nd ' +TO_CHAR(nd) + ' Get Payroll Assignment ID for '+ TO_CHAR(PAYROLL_ASSIGNED_EMPLOYEE_HR_ASSIGNMENT_ID[nd]) +' '+ PAYROLL_ASSIGNED_EMPLOYEE_PAYROLL_RELATIONSHIP_NUMBER[nd])
    IF (PAYROLL_ASSIGNED_EMPLOYEE_HR_ASSIGNMENT_ID[nd] = PER_HIST_ASG_ASSIGNMENT_ID[nc])
    THEN
    (
    L_PAYROLL_ASG_ID = PAYROLL_ASSIGNED_EMPLOYEE_HR_ASSIGNMENT_ID[nd]
    RET = ESS_LOG_WRITE(' Running Payroll Assignment ID by DBI: ' + TO_CHAR(PAYROLL_ASSIGNED_EMPLOYEE_PAYROLL_ASSIGNMENT_ID[nd]))
    EXIT
    )
    nd = PAYROLL_ASSIGNED_EMPLOYEE_HR_ASSIGNMENT_ID.NEXT(nd,-1234)
    )

    )
    )

    ReplyDelete
  6. RET = ESS_LOG_WRITE(' Starting Count of Eligible Bonus days for Assignment ' + PER_ASG_ASSIGNMENT_NUMBER +' from '+ SUBSTR(TO_CHAR(l_asg_start_date),1,10) + ' to ' + SUBSTR(TO_CHAR(l_asg_end_date),1,10))

    WHILE (l_asg_start_date =< l_asg_end_date)
    LOOP
    (

    l_bonus_eligibility = 'X0X0'

    /* Setting Input to call LDG Specific FF */

    IF (IS_EXECUTABLE('XXGEN_GET_BONUS_FLAG'))
    THEN
    (
    SET_INPUT('PERS_ID', PER_HIST_ASG_PERSON_ID[nc])
    SET_INPUT('ASSIGNMENT_ID', PER_HIST_ASG_ASSIGNMENT_ID[nc])
    SET_INPUT('L_START_DATE',l_asg_start_date)
    SET_INPUT('L_END_DATE',l_asg_end_date)
    SET_INPUT('L_PAYROLL_REL_ID', PER_HIST_ASG_PAY_RELATIONSHIP_ID[nc])
    SET_INPUT('L_PAYROLL_ASG_ID', L_PAYROLL_ASG_ID)
    RET = ESS_LOG_WRITE( ' Call Local Formula ' )
    EXECUTE('XXGEN_GET_BONUS_FLAG')
    l_bonus_eligibility = GET_OUTPUT('l_output', 'X0X0')
    RET = ESS_LOG_WRITE(' Called Formula Return value :' + l_bonus_eligibility)
    )
    IF l_bonus_eligibility = 'Y'
    THEN
    (
    l_total_bonus_elig_days = l_total_bonus_elig_days + 1

    )

    l_asg_start_date = ADD_DAYS (l_asg_start_date, 1)
    )
    )
    )
    nc = PER_HIST_ASG_ASSIGNMENT_ID.PREVIOUS(nc,-1234)
    )

    L_DEFAULT_VALUE = l_total_bonus_elig_days
    RET = ESS_LOG_WRITE( ' Final Return Total Eligible days : ' + TO_CHAR(L_DEFAULT_VALUE))
    RET = ESS_LOG_WRITE( '************** End Get Eligible Days **************')
    RETURN L_DATA_TYPE, L_DEFAULT_VALUE

    ReplyDelete
  7. ---------------------- Child FF ----------------------------
    /* ---------------------------------------------------------------------------------------------------------------------------
    ********************************************************************************************
    * NAME : XXGEN_GET_BONUS_FLAG
    * TYPE : Compensation Default and Override
    * Requirement: Formula to get employee Bonus Eligibility from BMM
    * LDG specific Fast formulas.
    ********************************************************************************************
    ---------------------------------------------------------------------------------------------------------------------------*/
    DEFAULT FOR BONUS_REVISION_MODULE_BONUS_ELIGIBILITY_ASG_ENTRY_VALUE IS 'X0X0'
    DEFAULT_DATA_VALUE FOR ELEMENT_ENTRY_REPORTING_NAME IS 'Bonus Revision Module'

    INPUTS ARE PERS_ID (number),
    ASSIGNMENT_ID (number),
    L_START_DATE (date),
    L_END_DATE (date),
    L_PAYROLL_REL_ID (number),
    L_PAYROLL_ASG_ID (number)

    l_output = 'X0X0'
    RET = ESS_LOG_WRITE( '**************Begin Local Function to get Bonus Eligibility Flag from BMM **************')
    RET = ESS_LOG_WRITE( ' Called Local Formula ' )

    CHANGE_CONTEXTS(HR_ASSIGNMENT_ID = ASSIGNMENT_ID, PAYROLL_RELATIONSHIP_ID = L_PAYROLL_REL_ID, PAYROLL_ASSIGNMENT_ID = L_PAYROLL_ASG_ID)
    (
    CHANGE_CONTEXTS(EFFECTIVE_DATE = L_START_DATE, DATE_EARNED = L_START_DATE)
    (
    IF BONUS_REVISION_MODULE_BONUS_ELIGIBILITY_ASG_ENTRY_VALUE WAS NOT DEFAULTED
    THEN
    (
    l_output = BONUS_REVISION_MODULE_BONUS_ELIGIBILITY_ASG_ENTRY_VALUE
    RET = ESS_LOG_WRITE(' Bonus Eligibility Flag element entry on : ' + SUBSTR(TO_CHAR(L_START_DATE),1,10) + l_output)
    )
    )
    )

    RET = ESS_LOG_WRITE(' Local Formula Return :' + l_output)
    RET = ESS_LOG_WRITE( '************** End Local Function to get Bonus Eligibility Flag from BMM **************')
    RETURN l_output

    Thanks,
    Sankara K

    ReplyDelete
    Replies
    1. It may not be the issue that I thought.
      The parent formula always calls the Child formula that belongs to the initial LDG.
      I don’t know how to calls the formula of different LDG.

      I assume that the formula is not calling the right child FF.
      The parent calls the sub program that belongs to the initial LDG.
      I assume the Assignment may not belongs to the same LDG.
      Please debug the Cuurent LDG from the parent formula
      LDG of the assignment within the change contest.
      The child formula and its default LDG name in the child formula.

      This will indicate what is going wrong.
      Please let me know if my assumption is wrong

      Delete
    2. Well, Look like the calling child formula of different LDG is not supported as of now.
      Instead of calling child formula, why can’t you use the DBI like ELEMENT_ENTRY_VALUE.
      These (ELEMENT_ENTRY_XXXXXXXX) array DBI are extracted for PAYROLL_RELATIONSHIP_ID, DATE_EARNED and
      EFFECTIVE_DATE. You can loop through the array and validate the element name,ELEMENT_ENTRY_BASE_ELEMENT_NAME.
      If the name matches you can use the value, ELEMENT_ENTRY_VALUE for your calculation

      Hope this helps

      Delete
    3. Also found one more set DBI ELEMENT_ENTRY_RGE_VALUE (ELEMENT_ENTRY_RGE_XXXXXXXX) works with PAYROLL_RELATIONSHIP_ID, END_DATE, START_DATE

      Delete
  8. Hi Guys,

    I have question although I saw your reply.
    Is it possible to have a Participation and Eligibility formula type that will work for multiple LDGs ? I wrote one, it is Ok with one LDG, but not Ok with multiple LDGs.
    What can be the approach in this situation ?
    I saw your comment 'Well, Look like the calling child formula of different LDG is not supported as of now'. Is this available for any formula type ?


    Regards,
    Gabriela

    ReplyDelete
    Replies
    1. Hi Gabriela,
      I should have used the word “child formula of different LDG is not supported” very carefully.
      It is not supported in one execution. Let me explain with an example.
      Employee A worked for US and transferred to UK.
      The employee has two Assignments in a period, one for US LDG and another for UK LDG.
      When the Formula is executed for US assignment ,
      the formula can call the US LDG specific child formula.
      In the same way, when the formula is executed for UK assignment, the formula can call the UK specific LDG child formula. But formula can not call the UK specific formula for the US assignment and US specific formula for UK assignment.
      In other words, you cannot determine or switch which formula needs to be called.
      It is determined by the default assignment LDG

      Delete
  9. Hello Tilak & Lakshmi,

    Yeah I already thought about it, for using ELEMENT_ENTRY_XXXXXXXX we need an DBI for Input Value Name.

    For example when we have more than one input value we need to loop ELEMENT_ENTRY_VALUE array DBI and get the value. But we have ELEMENT_ENTRY_INPUT_ID DBI only. So we cannot hard code Input value ID to get the correct ELEMENT_ENTRY_VALUE.

    Is there any DBI for INPUT Name accessible in Compensation Default & Override FF ?

    Thanks,
    Sankara K

    ReplyDelete
    Replies
    1. The following two DBI get you the base name from input_values.

      ELEMENT_ENTRY_BASE_VALUE_NAME
      ELEMENT_ENTRY_RGE_BASE_VALUE_NAME

      Delete
    2. Yes, Thanks a lot for the DBI. It worked.

      Even if we sort this out by not calling a Child FF to get element value other Child FF's are creating same problem.

      Say we need LE code of the employee which is stored as LE Identifier. The DBI PER_LEMP_LEGAL_ENTITY_IDENTIFIER is not accessible in Compensation FF so we created an Extract FF and calling it get the value.

      For first assignment ID it is working and for second assignment ID it is returning same error.

      CMP_CWB_PARTI_PROCESS_PKG.get_attribute_value-Secondary
      DEFAULT VALUE RULE ERROR: 300000041026116
      ASSIGNMENT ID: 300000041392130
      ITEM NAME: CustomSegment1
      ERROR: ORA-01403: no data found
      ORA-01403: no data found

      Even though the second assignment is in same LDG.

      Delete
    3. Glad the issue is solved.
      Look like you are facing the issue originally I was thinking about.
      Provide me the logs, ff. Let me see what I can do.
      By the time ask oracle to post it in their forum.

      Delete
    4. Yeah, raised SR and in touch with CoE & Development on this issue.

      Delete
  10. Hello Gabriela,

    For me the issue is calling Child FF for multiple assignments of an employee in the Parent FF.

    You can try Changing the Context as LDG ID using PER_ASG_LEGISLATIVE_ID

    Thanks,
    Sankara K

    ReplyDelete
    Replies
    1. changing the LDG context does not help calling the Child Formula. the parent still calls the original/initial LDS's child formula.

      Delete
    2. Hi Guys,

      Let me explain it in more details.
      I have a compensation plan. It has to be executed for multiple LDGs at the same time. I mean I launch the Start Compensation Cycle and I don't select any parameter so it will be for the Enterprise which has 5 LDGs. I wrote the same Participation and Rate Eligibility FF ( a simple one ) for each LDG. What should happen when the cycle is started: the FF to be read and applied for each LDG ? And if an employee changes LDG during the year, the person will appear one in the first LDG and the second time in the second LDG and for each LDG the FF is applied for employee data corresponding to that LDG. This is what I understood fom your above example. So, it is correct if each LDG has its own FF. Am I right ?
      Because if I write an FF with no LDG and within that FF I change contexts it will not work. I tried this and it didn't work.

      Regards,
      Gabriela

      Delete
  11. You can have a non LDG specific FF (Global) and do a call to an LDG specific FF (Local). No need to change contexts. System has a limitation- if you have multiple assignments for an employee in different LDG's within the plan date calling 1 Local FF for first assignment and calling another Local FF for different assignment is not allowed now.

    ReplyDelete
  12. Hi Has any one created FF for Time and Labor setup rules ?

    ReplyDelete
    Replies
    1. Actually I have a requirement to create a fast formula which will allow people to enter time card of present month only. Any idea on how we can write that ?

      Delete
    2. I have not yet tried any WFM formulas. As per my understanding, you need to use the formula type, WORKFORCE_MANAGEMENT_TIME_ENTRY_RULES. There are many seeded formula on this type.
      You can try WFM_PERIOD_MINIMUM_TIME_ENTRY_RULE_AP or WFM_PERIOD_MINIMUM_TIME_ENTRY_RULE.

      please let me know if they are not helping you.

      Delete
    3. Thanks Will try and let you know

      Delete
  13. Hi
    Have anyone tried getting numeric rating competency.....
    I tried a lot ....but my rating is pointing 0 will all this

    HRT_PERSON_PRFRAT_NUMERIC_RATING TN
    HRA_SECTION_RATING_FF_NUMERIC_RATING
    HRT_RATING_LEVEL_NUMERIC_RATING
    HRA_EVAL_GOAL_RATING_FC_NUMERIC_RATING
    HRA_EVAL_GOAL_RATING_FC_TARGET_NUMERIC_RATING
    HRA_EVAL_GOAL_SECTION_RATING_FC_NUMERIC_RATING
    HRA_EVAL_ITEM_RATING_FC_NUMERIC_RATING
    HRA_EVAL_ITEM_RATING_FC_TARGET_NUMERIC_RATING
    HRA_EVAL_OS_SECTION_RATING_FC_NUMERIC_RATING
    HRA_EVAL_PROFILE_CONTENT_RATING_FC_NUMERIC_RATING
    HRA_EVAL_PROFILE_CONTENT_RATING_FC_TARGET_NUMERIC_RATING
    HRA_EVAL_SECTION_RATING_FC_NUMERIC_RATING
    HRA_EVAL_COMP_RATING_FC_NUMERIC_RATING
    HRA_EVAL_COMP_RATING_FC_TARGET_NUMERIC_RATING
    HRA_EVAL_COMP_SECTION_RATING_FC_NUMERIC_RATING

    and my formula is
    *******************************************************************
    /*================DEFAULT SECTION BEGIN=========================*/
    DEFAULT_DATA_VALUE FOR HRA_EVAL_COMP_RATING_FC_NUMERIC_RATING IS 0
    DEFAULT_DATA_VALUE FOR HRA_EVAL_ITEM_RATING_FC_NUMERIC_RATING IS 0
    DEFAULT_DATA_VALUE FOR HRA_EVAL_COMP_RATING_FC_TARGET_NUMERIC_RATING IS 0
    DEFAULT_DATA_VALUE FOR HRA_EVAL_PROFILE_CONTENT_RATING_FC_NUMERIC_RATING IS 0
    DEFAULT_DATA_VALUE FOR HRA_EVAL_PROFILE_CONTENT_RATING_FC_TARGET_NUMERIC_RATING IS 0
    /*DEFAULT_DATA_VALUE FOR HRA_SECTION_RATING_FF_NUMERIC_RATING IS 0*/
    DEFAULT_DATA_VALUE FOR HRA_EVAL_ITEM_RATING_FC_TARGET_NUMERIC_RATING IS 0

    DEFAULT_DATA_VALUE FOR HRA_EVAL_COMP_RATING_FC_CONTENT_NAME IS 'XXX'
    DEFAULT_DATA_VALUE FOR HRA_EVAL_ITEM_RATING_FC_ITEM_NAME IS 'XXX'

    DEFAULT_DATA_VALUE FOR HRA_EVAL_PROFILE_CONTENT_RATING_FC_CONTENT_NAME IS 'XXX'
    DEFAULT_DATA_VALUE FOR HRT_PROFILE_ITEM_CONTENT_ITEM_NAME IS 'XXX'
    DEFAULT_DATA_VALUE FOR HRG_GOAL_TARGET_OUTCOMES_CONTENT_ITEM_NAME IS 'XXX'
    DEFAULT_DATA_VALUE FOR HRG_GOAL_TARGET_OUTCOME_CONTENT_ITEM_NAME IS 'XXX'

    DEFAULT_DATA_VALUE FOR HRA_EVAL_COMP_RATING_FC_CONTENT_TYPE_NAME IS 'XXX'
    DEFAULT_DATA_VALUE FOR HRA_EVAL_ITEM_RATING_FC_CONTENT_TYPE_NAME IS 'XXX'
    DEFAULT_DATA_VALUE FOR HRT_PROFILE_ITEM_CONTENT_TYPE_NAME IS 'XXX'
    DEFAULT_DATA_VALUE FOR HRA_EVAL_PROFILE_CONTENT_RATING_FC_CONTENT_TYPE_NAME IS 'XXX'

    DEFAULT_DATA_VALUE FOR HRA_EVAL_COMP_RATING_FC_CALCULATED_SCORE IS 0
    DEFAULT_DATA_VALUE FOR HRA_SECTIONS_RATINGS_CONTENT_TYPE_ID IS 0

    DEFAULT_DATA_VALUE FOR HRA_EVAL_COMP_RATING_FC_CONTENT_ITEM_CODE IS 'XXX'
    DEFAULT_DATA_VALUE FOR HRA_EVAL_PROFILE_CONTENT_RATING_FC_CONTENT_ITEM_CODE IS 'XXX'
    DEFAULT_DATA_VALUE FOR HRA_EVAL_ITEM_RATING_FC_SECTION_TYPE_CODE IS 'XXX'

    /*================DEFAULT SECTION ENDS============================*/
    INPUTS ARE HRA_SECTION_RATING_FF_NUMERIC_RATING(NUMBER_NUMBER)
    /*================ FORMULA SECTION BEGINS =======================*/
    L_RETURN_VALUE = 0
    I=1
    j= 1
    while HRA_EVAL_COMP_RATING_FC_CONTENT_NAME.EXISTS(j) LOOP
    (
    L_RETURN_VALUE =HRA_SECTION_RATING_FF_NUMERIC_RATING[j] + L_RETURN_VALUE
    j = j+1
    )

    /*================ FORMULA SECTION ENDS =======================*/
    RETURN L_RETURN_VALUE

    ReplyDelete
    Replies
    1. Hi Shanmukanathan,
      I cannot tell why your formula is not returning the value but I can help you analyze the situation.
      We always recommend debugging your code to find the cause. if this FF executed in ESS then you can use ESS_LOG_WRITE() function to write the value in ess log. If it is not executed in ESS then you need to ask the support how to debug the value.
      If you are not able to find it let me know, I can find a workaround for you.

      1) the DBI HRA_EVAL_COMP_RATING_FC_CONTENT_NAME and HRA_SECTION_RATING_FF_NUMERIC_RATING using different routes. In other words DBI are using different SQL to get the value and both DBI using different context therefore it is advisable to use the DBI from same routs while looping.
      You can change the code as follows
      J = HRA_SECTION_RATING_FF_NUMERIC_RATING.FIRST(-1)
      /* Debug the j value. So you that you know whether there is any value in the dbi */
      while HRA_SECTION_RATING_FF_NUMERIC_RATING.EXISTS(j) LOOP
      (
      L_RETURN_VALUE =HRA_SECTION_RATING_FF_NUMERIC_RATING[j] + L_RETURN_VALUE
      /* Debug the j value. And return value */

      j = HRA_SECTION_RATING_FF_NUMERIC_RATING.NEXT(j,-1)
      )
      2) Still if you are not getting value, debug the context PERSON_ID and HR_ASSIGNMENT_ID and let me know the values, I can help debugging further.

      Delete
  14. Tilak / Lakshmi,
    I am new to Oracle Fast Formula. I have a requirement to calculate bonus . Here is the one which I wrote which is throwing error. Could you please guide me on this.


    /*=========== INPUT VALUES DEFAULTS BEGIN =====================*/
    INPUTS ARE CMP_IV_ASSIGNMENT_ID (number),
    CMP_IV_PLAN_ID (number),
    CMP_IV_PERIOD_ID (number),
    CMP_IV_COMPONENT_ID (number)
    DEFAULT FOR CMP_ASSIGNMENT_SALARY_DATE_TO IS '4712/12/31' (date)
    DEFAULT_DATA_VALUE FOR CMP_ASSIGNMENT_SALARY_CHANGE_AMOUNT IS 0
    DEFAULT_DATA_VALUE FOR CMP_ASSIGNMENT_SALARY_RGE_ASSIGNMENT_ID IS 0
    DEFAULT FOR ASG_HR_ASG_ID IS 0
    DEFAULT_DATA_VALUE FOR CMP_ASSIGNMENT_RGE_SALARY_COMPONENT_NAME IS ' '
    DEFAULT_DATA_VALUE FOR CMP_ASSIGNMENT_RGE_SALARY_CHANGE_AMOUNT IS 0
    /*=========== INPUT VALUES DEFAULTS ENDS======================*/

    /*================ FORMULA SECTION BEGIN =======================*/
    l_assignment_id = 0
    l_change_amount = 0
    c_eff = '2015/11/4' (date)
    c_assignment_id = 0
    TOTAL_COMPONENT_AMOUNT = 0
    l_assignment_id = ASG_HR_ASG_ID
    CHANGE_CONTEXTS(START_DATE = '1951/1/1'(date))
    ( IF CONTEXT_IS_SET(START_DATE) THEN
    ( c_eff = get_context(START_DATE, '2017/01/01' (date))
    L_DEBUG = ess_log_write('Context Eff--->'+to_char(c_eff))
    )
    CHANGE_CONTEXTS (HR_ASSIGNMENT_ID = l_assignment_id)
    ( IF CONTEXT_IS_SET(HR_ASSIGNMENT_ID) THEN
    ( c_assignment_id = get_context(HR_ASSIGNMENT_ID, 0)
    L_DEBUG = ess_log_write('Context ass--->'+to_char(c_assignment_id))
    )
    N = CMP_ASSIGNMENT_RGE_SALARY_COMPONENT_NAME.FIRST(-1234)
    WHILE CMP_ASSIGNMENT_RGE_SALARY_COMPONENT_NAME.EXISTS(N)LOOP
    ( L_DEBUG = ess_log_write('Salary Component Name --->'+CMP_ASSIGNMENT_RGE_SALARY_COMPONENT_NAME[N])
    IF CMP_ASSIGNMENT_RGE_SALARY_COMPONENT_NAME[N] = 'C11 Bonus'
    THEN (
    SALARY_COMPONENT_AMOUNT = 0
    SALARY_COMPONENT_AMOUNT = CMP_ASSIGNMENT_RGE_SALARY_CHANGE_AMOUNT[N]
    TOTAL_COMPONENT_AMOUNT = TOTAL_COMPONENT_AMOUNT + SALARY_COMPONENT_AMOUNT
    )
    N = CMP_ASSIGNMENT_RGE_SALARY_COMPONENT_NAME.NEXT(N,-1234)
    )
    )
    L_DEFAULT_VALUE = TO_CHAR(TOTAL_COMPONENT_AMOUNT)
    RETURN L_DEFAULT_VALUE
    )

    When I executed this formula, the following error was encountered.


    CMP_CWB_UTILS..formula_tester_setup
    DEFAULT VALUE RULE ERROR:300000129482237
    ASSIGNMENT ID: 300000049043707ITEM NAME: AmountComp2
    ERROR: ORA-20001: An Oracle error occurred in formula C11_BONUS_US_TEST when attempting to execute formula PL/SQ

    ReplyDelete
  15. Forgot to mention, I am using the Compensation Default and Override formula type.

    ReplyDelete
    Replies
    1. Hi,

      Can you pls try the following. You do not need to set asgid.
      It is already set.


      INPUTS ARE CMP_IV_ASSIGNMENT_ID (number),
      CMP_IV_PLAN_ID (number),
      CMP_IV_PERIOD_ID (number),
      CMP_IV_COMPONENT_ID (number)
      DEFAULT FOR CMP_ASSIGNMENT_SALARY_DATE_TO IS '4712/12/31' (date)
      DEFAULT_DATA_VALUE FOR CMP_ASSIGNMENT_SALARY_CHANGE_AMOUNT IS 0
      DEFAULT_DATA_VALUE FOR CMP_ASSIGNMENT_SALARY_RGE_ASSIGNMENT_ID IS 0
      DEFAULT_DATA_VALUE FOR CMP_ASSIGNMENT_RGE_SALARY_COMPONENT_NAME IS ' '
      DEFAULT_DATA_VALUE FOR CMP_ASSIGNMENT_RGE_SALARY_CHANGE_AMOUNT IS 0
      /*=========== INPUT VALUES DEFAULTS ENDS======================*/

      /*================ FORMULA SECTION BEGIN =======================*/
      l_assignment_id = 0
      l_change_amount = 0
      c_eff = '2015/11/4' (date)
      c_assignment_id = 0
      TOTAL_COMPONENT_AMOUNT = 0
      CHANGE_CONTEXTS(START_DATE = '1951/1/1'(date))
      (
      c_eff = get_context(START_DATE, '2017/01/01' (date))
      L_DEBUG = ess_log_write('Context Eff--->'+to_char(c_eff))
      c_assignment_id = get_context(HR_ASSIGNMENT_ID, 0)
      L_DEBUG = ess_log_write('Context ass--->'+to_char(c_assignment_id))
      N = CMP_ASSIGNMENT_RGE_SALARY_COMPONENT_NAME.FIRST(-1234)
      WHILE CMP_ASSIGNMENT_RGE_SALARY_COMPONENT_NAME.EXISTS(N)LOOP
      (
      L_DEBUG = ess_log_write('Salary Component Name --->'+CMP_ASSIGNMENT_RGE_SALARY_COMPONENT_NAME[N])
      IF CMP_ASSIGNMENT_RGE_SALARY_COMPONENT_NAME[N] = 'C11 Bonus' THEN
      (
      SALARY_COMPONENT_AMOUNT = 0
      SALARY_COMPONENT_AMOUNT = CMP_ASSIGNMENT_RGE_SALARY_CHANGE_AMOUNT[N]
      TOTAL_COMPONENT_AMOUNT = TOTAL_COMPONENT_AMOUNT + SALARY_COMPONENT_AMOUNT
      )
      N = CMP_ASSIGNMENT_RGE_SALARY_COMPONENT_NAME.NEXT(N,-1234)
      )
      )

      L_DEFAULT_VALUE = TO_CHAR(TOTAL_COMPONENT_AMOUNT)
      RETURN L_DEFAULT_VALUE


      Delete
  16. Hi TL,
    Its not working. So I updated the formula as follows. Also, I don't know how to debug it. Where does the log reside for ews_log. Please let me know.
    Thanks,
    ASrikanth

    ReplyDelete
  17. Here is the updated one which is not working as well.
    /*=====================================================================
    Formula Name: TI Bonus calculation
    Formula Type: Compensation Default and Override
    Description: Return the Amount Entry value from Bonus Entity
    Created by: ASrikanth
    =======================================================================*/

    /*===================DEFAULT VALUE START===============================*/
    Default for C11_TI_BONUS2_AMOUNT_ASG_ENTRY_VALUE is 0
    DEFAULT FOR CMP_IV_PLAN_START_DATE IS '2001/01/01'
    DEFAULT FOR CMP_IV_PLAN_END_DATE IS '4712/01/01'

    /*==================DEFAULT VALUE END==================================*/

    /*=================INPUT START=========================================*/
    /**INPUTS ARE CMP_IV_PLAN_ID (number), CMP_IV_PERIOD_ID (number),
    CMP_IV_COMPONENT_ID (number), CMP_IV_ITEM_NAME (text),**/
    INPUTS ARE CMP_IV_PLAN_START_DATE (TEXT), CMP_IV_PLAN_END_DATE (TEXT)
    /*=========== INPUT VALUES ENDS========================================*/
    /*==================CALCULATION START==================================*/
    L_DATA = ESS_LOG_WRITE( 'Start Date :' || CMP_IV_PLAN_START_DATE)
    L_DATA = ESS_LOG_WRITE( 'End Date :' || CMP_IV_PLAN_END_DATE)

    /*l_hr_assign_id = get_context(HR_ASSIGNMENT_ID,-1)*/
    l_eff_date = get_context(DATE_EARNED,'1951/01/01 00:00:00'(date))
    l_payroll_assign_id = get_context(PAYROLL_ASSIGNMENT_ID, -1)

    L_PL_START_DATE = TO_DATE(CMP_IV_PLAN_START_DATE,'YYYY/MM/DD')
    L_PL_END_DATE = TO_DATE(CMP_IV_PLAN_END_DATE,'YYYY/MM/DD')
    TOTAL_BONUS_AMOUNT = 0

    /* Determine the First date */
    L_PL_START_DATE = TO_DATE('2017/01/01','YYYY/MM/DD')
    L_PL_END_DATE = TO_DATE('2017/02/01','YYYY/MM/DD')
    IF (L_PL_START_DATE <> ROUND(L_PL_START_DATE, 'MM')) THEN
    (
    L_PL_START_DATE = TRUNC(ADD_MONTHS(L_PL_START_DATE, 1), 'MM')
    L_DATA = ESS_LOG_WRITE( 'New Start Date :' ||TO_CHAR( L_PL_START_DATE,'YYYY/MM/DD'))
    L_DATA = ESS_LOG_WRITE( 'New End Date :' || TO_CHAR( L_PL_END_DATE,'YYYY/MM/DD'))
    )

    WHILE (L_PL_START_DATE <= L_PL_END_DATE)
    LOOP(
    L_DATA = ESS_LOG_WRITE( 'New Start Date in Loop :' ||TO_CHAR( L_PL_START_DATE,'YYYY/MM/DD'))

    CHANGE_CONTEXTS(EFFECTIVE_DATE = L_PL_START_DATE)
    (
    IF CONTEXT_IS_SET(EFFECTIVE_DATE) THEN
    (
    L_DATA = ESS_LOG_WRITE( 'Bonus :' + TO_CHAR(C11_TI_BONUS2_AMOUNT_ASG_ENTRY_VALUE))
    IF (C11_TI_BONUS2_AMOUNT_ASG_ENTRY_VALUE WAS NOT DEFAULTED ) THEN
    (
    BONUS_COMPONENT_AMOUNT = C11_TI_BONUS2_AMOUNT_ASG_ENTRY_VALUE
    TOTAL_BONUS_AMOUNT = TOTAL_BONUS_AMOUNT + BONUS_COMPONENT_AMOUNT
    L_DATA = ESS_LOG_WRITE( 'Bonus:' || TO_CHAR(C11_TI_BONUS2_AMOUNT_ASG_ENTRY_VALUE))
    )
    )
    )
    L_PL_START_DATE = ADD_MONTHS(L_PL_START_DATE, 1)
    )

    L_DEFAULT_VALUE = TOTAL_BONUS_AMOUNT
    RETURN L_DEFAULT_VALUE




    Error
    CMP_CWB_UTILS..formula_tester_setup
    DEFAULT VALUE RULE ERROR:300000129591580
    ASSIGNMENT ID: 300000049043707ITEM NAME: AmountComp4
    ERROR: ORA-20001: An Oracle error occurred in formula C11 TI BONUS TEST2 when attempting to execute formula PL/S

    ReplyDelete
    Replies
    1. the one I gave you worked for me.
      Well, let me try with your changes, by the time , you can add lot of ess_log in your ff and attach the ff to cwb plan and process the plan (ignore the ff tester foe the timing). You can see the logs in the ess child process (pls note the person is processed by the child process) and let me know the log.

      Delete
    2. I do not have the same DBI to test your FF.
      Have you created the FF with LDG?. Is the person you are using to test the ff belongs to same LDG ?

      Delete
  18. Thank you TK for the Super quick response. I don't know how to debug . I have added lots of ews logs but not sure where to see the logs. You had mentioned about ess_log... Let me add that to my code. But where do I see the logs. Let me first try and let you know.

    ReplyDelete
  19. Sorry. I was use ess_log_write earlier in my code. Can you let me where to look for the logs. I have just taken the baby steps in Oracle HCM. Thank you TK.

    ReplyDelete
  20. Yes TK. Yes, I had created the FF with LDG and the person I am using to test belongs to the same US LDG only.

    ReplyDelete
    Replies
    1. it is already in the blog

      you can see the log messages in Compensation -> Run Batch Process -> Monitor process -> Log and output (Navigation may vary from release to release). By checking the log, you can easily debug the Fast Formula.

      select the request. go to the end of the page, you can see an attachment link for the log.

      Delete
    2. This comment has been removed by the author.

      Delete
  21. Thanks TK. Finally cracked it... Thanks for your help again.

    ReplyDelete
    Replies
    1. Glad it worked for you

      anyway I just compiled the answer. Somebody else can make use of it



      Whenever you are using the array element, you need to make sure the elements are from the same route. Unfortunately it is difficult for new users. You can find out from the name.

      In your case you are using element from different routs (ELEMENT_ENTRY_BASE_ELEMENT_NAME, ELEMENT_ENTRY_RGE_BASE_VALUE_NAME). You are validating element name based on first array (ELEMENT_ENTRY_BASE_ELEMENT_NAME) and getting value from different array (ELEMENT_ENTRY_RGE_BASE_VALUE_NAME) that is the reason you are getting values from all the elements.
      The following is the sample of right code. I have neither compiled not validated the code. It is just an sample, pls make sure the DBI are declared and compiled fine.
      TOTAL_BONUS_AMOUNT = 0
      WHILE (L_PL_START_DATE <= L_PL_END_DATE)
      LOOP(
      L_DATA = ESS_LOG_WRITE( 'l pl start date :' ||TO_CHAR( L_PL_START_DATE,'YYYY/MM/DD'))
      N = ELEMENT_ENTRY_BASE_ELEMENT_NAME.FIRST(-1234)
      WHILE ELEMENT_ENTRY_BASE_ELEMENT_NAME.EXISTS(N)LOOP
      (
      IF ELEMENT_ENTRY_BASE_ELEMENT_NAME[N] = 'TI CRP BONUS' THEN
      (
      IF ELEMENT_ENTRY_BASE_VALUE_NAME[N] = = 'Amount' THEN
      (
      BONUS_COMPONENT_AMOUNT = 0
      BONUS_COMPONENT_AMOUNT = ELEMENT_ENTRY_VALUE[N]
      TOTAL_BONUS_AMOUNT = TOTAL_BONUS_AMOUNT + BONUS_COMPONENT_AMOUNT
      )
      )
      N = ELEMENT_ENTRY_BASE_ELEMENT_NAME.NEXT(N,-1234)
      )
      L_PL_START_DATE = ADD_MONTHS(L_PL_START_DATE, 1)
      )
      L_DEFAULT_VALUE = TOTAL_BONUS_AMOUNT
      L_DATA = ESS_LOG_WRITE('Bonus Amount' || TO_CHAR (L_DEFAULT_VALUE) )
      RETURN L_DEFAULT_VALUE

      Delete
  22. Thanks TK. Have a question. Lets say we need to call the formula for multiple LDG's and the element name (say bonus) is unique to each LDG, then the formula will not work. In the earlier example, I had hard-coded the element name as 'CRP BONUS' which is specific to US LDG. China LDG may have a diff bonus element name say 'CHN CRP BONUS'. How do we handle such situations. We need a formula which is common to all LDG's. Need your inputs/suggestions on this.
    Thank you,
    AS

    ReplyDelete
  23. If the bonus name follows the same pattern, then we can use the "like" operator. But is there a way to avoid hard-coding the element name in the code.

    ReplyDelete
    Replies
    1. please go through my parent and child blog (march, 2016). if you still have question, let me know.

      Delete
    2. When you use payroll related DBI, you need to create FF for a ldg. So you may end up creating formula for each LDG (Same name)

      Delete
    3. Ok. Will go thru your blog to get more information.

      Delete
  24. TK, How do we get the value of previous year using the functions available in FF. I need to calculate the bonus for the previous year - 1. For ex. if the compensation plan year is 2016, I need to calculate the bonus for 2015. I tried with the available functions like ADD_YEARS(comp plan st date , -1) but this is not working...
    Need your inputs on this.
    Thank you,
    AS

    ReplyDelete
    Replies
    1. can you please explain me 'but this is not working'. are you not getting what you want or it is throwing an error. a simple example of parameter and return value of what it does and what you ex[ectaion would help.
      I don't think there any issue with the function.
      There are few alternatives to that
      ADD_DAYS(date, n)
      ADD_MONTHS(date, n)

      Delete
  25. TK, I got the value by using the SUBSTR function. I didnt think of this earlier. I was using date related functions which didnt work. Thank you.
    AS

    ReplyDelete
    Replies
    1. that is good.
      I do not know what you are doing, be cautious about the format of the date, it might be different in different time zone, unless you use/force the format.
      Good luck

      Delete
  26. Hi TK,
    Have a question on Balance and Dimensions. I have to write a Fast formula to fetch the corresponding YTD amount for the Balance and Dimension. I am unable to find the Related DBI.
    Balance Name is 'EPS Profit Sharing'
    Dimension Name is 'Relationship Tax Unit Year to Date'
    Please share if you have any information on the FOrmula type to be used and the related DBI...
    Thanks,
    AS

    ReplyDelete
    Replies
    1. Payroll balances creates the DBI dynamically. It must be there in the same name. EVERY PAY Balance creates more than once DBI and the DBI uses different contexts.
      I think the Simple YTD one uses PAYROLL_REL_ACTION_ID.
      Most of the payroll FF Types supports. You can use Oracle Payroll or Extract Rule or Rate Conversion
      Hope this helps

      Delete
  27. This comment has been removed by the author.

    ReplyDelete
  28. This comment has been removed by the author.

    ReplyDelete
  29. This comment has been removed by the author.

    ReplyDelete
  30. Thank you TK. Please correct me if my approach is wrong. I am using Oracle Payroll Formula Type...I have created 2 Fast Formulas. RIght now, I am not sure which DBI should I use. So I have just printed those values to check which has the value which is hte same as it shows in UI screen
    1. TEST_BAL which is of Balance adjustment Formula Type and LDG is US
    2. TEST_COMP_BAL which is of Compensation Default and Override and this is GLOBAL.

    Compilation was successful. But during execution, I am getting this error
    Issue : The following error happens during the plan execution
    ERROR: ORA-20001: Formula TEST_BAL_1, line 31, user-defined function error The payroll relationship action ID is invalid. Contact your help desk.. Details: A function call raised an error during formula execution.
    I am sending the Formula in the next section.
    Here is the information regarding the Fast Formulas. PFA

    Formula Name Formula Type LDG
    _________________________________________________________________
    TEST_BAL_1 (Child) Balance Adjustment USA
    __________________________________________________________________
    COMP_TEST_BAL (Parent) Compensation Default and Override Global

    ReplyDelete
  31. Formula Name: TEST BAL_1
    Formula Type: BALANCE ADJUSTMENT
    Legislation: USA
    Description: Formula to return the YTD balance
    Formula Change History
    ----------------------

    /**************************** Alias Section Begin *****************************/
    /*************************** Default Section Begin ****************************/
    DEFAULT for EPS___PROFIT_SHARING_REL_TU_YTD is 0

    L_DATA_TYPE = 'NUMBER'
    L_DEFAULT_VALUE = 0
    l_payroll_rel_action_id = get_context(PAYROLL_REL_ACTION_ID,-1)
    l_tax_unit_id = get_context(TAX_UNIT_ID,-1)
    l_calc_breakdown_id = get_context(CALC_BREAKDOWN_ID,-1)
    CHANGE_CONTEXTS(PAYROLL_REL_ACTION_ID = l_payroll_rel_action_id, TAX_UNIT_ID = l_tax_unit_id, CALC_BREAKDOWN_ID = l_calc_breakdown_id)
    (
    L_DATA = ESS_LOG_WRITE('PAYROLL REL ACTION ID : ' || TO_CHAR(L_PAYROLL_REL_ACTION_ID))
    L_DEFAULT_VALUE = EPS___PROFIT_SHARING_REL_TU_YTD
    )
    L_DATA = ESS_LOG_WRITE('PROFIT SHARING YTD : ' || TO_CHAR(L_DEFAULT_VALUE))

    /********** Return Section Begin ************/
    RETURN L_DATA_TYPE
    ,L_DEFAULT_VALUE

    /****************************** End Fast Formula ******************************/

    /*******************************************************************************
    Formula Name: TEST COMP BAL
    Formula Type: Compensation Default and Override
    Legislation: Global
    Description: Parent Formula

    /**************************** Inputs Section Begin ******************************************************/
    inputs are CMP_IV_COMPONENT_ID (number)
    ,CMP_IV_ITEM_NAME (text)
    ,CMP_IV_PERIOD_ID (number)
    ,CMP_IV_PLAN_ID (number)
    ,CMP_IV_PLAN_END_DATE (date)
    ,CMP_IV_PLAN_START_DATE (date)
    /************************* Calculation Section Begin ****************************************************/

    L_DEFAULT_VALUE=0
    L_DATA_TYPE = 'NUMBER'

    l_year = to_char(CMP_IV_PLAN_START_DATE, 'YYYY')
    l_hr_assign_id = get_context(HR_ASSIGNMENT_ID,-1)
    l_eff_date = get_context(EFFECTIVE_DATE,'1951/01/01 00:00:00'(date))
    l_payroll_rel_id = get_context(PAYROLL_RELATIONSHIP_ID,-1)
    l_context_end_date = get_context(END_DATE,'1951/01/01 00:00:00'(date))
    l_date_earned = get_context(DATE_EARNED,'1951/01/01 00:00:00'(date))
    l_pay_assign_id = get_context(PAYROLL_ASSIGNMENT_ID, -1)

    l_cycle_date = to_date(('12/31/' || L_YEAR), 'MM/DD/YYYY')
    L_DATA = ESS_LOG_WRITE('YEAR :' +l_year)

    IF (IS_EXECUTABLE('TEST_BAL_1')) THEN
    (

    EXECUTE('TEST_BAL_1')
    L_DEFAULT_VALUE=GET_OUTPUT('L_DEFAULT_VALUE',120)
    )

    L_DATA =ESS_LOG_WRITE('BALANCE AFTER CALCULATION :' || TO_CHAR(L_DEFAULT_VALUE))
    L_DATA = ESS_LOG_WRITE('*************************END OF TEST COMP BALANCE ***************************')
    RETURN L_DEFAULT_VALUE

    ReplyDelete
    Replies
    1. For every DBI, the contexts need to be set right to get the values. Either the context set by the calling program or by the Fast formula using ‘change_context’
      You are using compensation formula as parent formula therefore the program that calls the compensation formula sets all the context that are need by the compensation formula.

      The Payroll contexts are not set by the compensation calling program. So It became you responsibility to set the context, Either you can set the context while calling the child formula or in the child formula without setting the context you dbi are not going to work.
      Hope this explains all you need.

      Delete
  32. Thank you TK for your inputs.
    I got the reason as to why the error is occurring.
    The main issue here is the contexts used are not getting set. For Balance adjustments Formula type, the following contexts are used.
    a) PAYROLL_REL_ACTION_ID
    b) TAX_UNIT_ID
    c) CALC_BREAKDOWN_ID.
    I used get_Context() to get the value of the contexts and handled Context_is_set condition to test whether or not the context value is set. But the value is not set for all the 3 Contexts.
    I am unable to get the documentation for Balance adjustments

    As this is my first experience in working with Parent and child being different formula types, I am not sure whether I need to include extra stuff to set the contexts. As no documentation is available for Balance adjustments Formula type, I need some experts help in this.
    Thanks,
    AS

    ReplyDelete
    Replies
    1. I have explained this concept in my parent and child fast formula blog.
      Now the question is how you are going to get the data for these context.
      Let me see if I can find a DBI that provides this information.
      I do not know you business requirement, is there any way you can use the DBI EPS___PROFIT_SHARING_REL_YTD instead of EPS___PROFIT_SHARING_REL_TU_YTD. The first DBI uses the context, PAYROLL_REL_ACTION_ID and we can find a dbi for, PAYROLL_REL_ACTION_ID .

      Delete
  33. Thanks TK for your response.
    The reason why I am using this DBI EPS___PROFIT_SHARING_REL_TU_YTD
    Balance name : EPS - Profit Sharing
    Dimension name : Relationship Tax Unit Year TO Date
    The DBI is automatically generated based on the balance name and dimension name...
    I tried searching for EPS___PROFIT_SHARING_REL_YTD in Balance adjustments formula type and I am unable to find one...

    ReplyDelete
    Replies
    1. pls let me the name of all the dbi starts with 'EPS___PROFIT_SHARING_REL'

      Delete
    2. Hi TK,
      Here is the list of DBI's
      EPS___PROFIT_SHARING_REL_TU_MTD
      EPS___PROFIT_SHARING_REL_TU_PTD
      EPS___PROFIT_SHARING_REL_TU_QTD
      EPS___PROFIT_SHARING_REL_TU_YTD
      Thanks,
      AS

      Delete
  34. Hi Talak,
    In Comp module, we have currently hard coded the currency name and rate in column defaults, so that we avoid using currency switching.
    Now we are nearing golive and it seems we have 100+ entries to hard code. Not sustainable to maintain in future. Now we searched for Manage Daily Rates as a option to upload using "Create in spreadsheet". We successfully uploaded, but struggling on how to get it into the FF and then to columns.. If you can suggest a solution, it will be of great help ! thanks !!

    ReplyDelete
    Replies
    1. Consider using the function GET_RATE. This function supports three parameters.
      rate_type
      to_currency
      from_currency
      the rate will be derived as of the effective date.

      Delete
  35. Thank you Tilak. Will try this function.
    Much appreciate your support !!

    ReplyDelete
  36. Hi Tilak

    We want to use fields captured in documents of records in fast formula but not sure how to call them in FF. Can you please help. ?

    ReplyDelete
    Replies
    1. do you know where the information is stored ?

      Delete
    2. Sorry, don't have any idea about it but i assume it will be stored in documents of records table.

      Delete
  37. Hello Tilak & Lakshmi,

    In compensation default and override FF can we get the parameters passed in the Start compensation process ? I need the flag for "Trail Run" as an input parameter.

    ReplyDelete
    Replies
    1. I don't think the trial run value is available in FF

      Delete
  38. Hi Tilak & Lakshi,

    I am new to fast formulas and learning a basics from your blog. I have a requirement as below and need your inputs

    Based on the employee location & Salary FF need return travelling allowance per month. But the payroll was weekly/hourly payroll.

    Is there any DBI to get the Monthly Salary of an employee?
    We have any standard function/formula to calculate the monthly salary of an employee?
    How to calculate the monthly salary of an employee in FF, when the payroll was hourly/weekly?

    Your help is highly appreciated.

    Thanks
    Subbu

    ReplyDelete
    Replies
    1. there no dbi for monthly salary but you can find one fro annual salary.
      you can divide that by 12 to get monthly salary.

      Delete
    2. Hi Tilak and Lakshmi,

      Thanks for the update. But in my case, I need actual salary for that month (If the employee had unpaid leaves in that month)?
      Annual salary/12 won't work for in my case. Is there any other way to calculate actual earned for that month?

      Thanks
      Subbu

      Delete
    3. Sorry for my late reply.
      Salary DBI has only the defined salary information.
      You may get the actual values from
      1) element entry values DBI (payroll)
      2) Get the number of working days from absences and calculate with salary
      3) You can have your own query using payroll value sets.

      Delete
  39. Hi,

    I want to use the Comp User Defined Columns in Comp Default and Override type Fast formula. would you please help me how to use this in FF.

    Thanks & Regards,
    AR.Kumar

    ReplyDelete
    Replies
    1. can you please be more specific?. Do you want to attach the formula to UD column or you want to get the value from UD column in your fast formula?

      Delete
  40. Hi,

    Thanks for Quick response. actually the requirement is to apply the Rounding rule to UD Column based on Employee payroll Country. so i need to attach the FF to corresponding UD Column.

    Thanks,
    AR.Kumar

    ReplyDelete
    Replies
    1. what is the problem? is it the problem in attaching formula or returning value? UD Columns supports 'Default and override formula.
      Unless until you explain me the exact issue and the steps you tried, I can't do anything.

      Delete
  41. Hi,

    I need to apply the Rounding rule based on Emp Payroll country to UD column(Numeric column 17). which DBI need to use in FF.

    Thanks,
    AR.Kumar

    ReplyDelete
    Replies
    1. you are not telling me the problem, if you are expecting me to write a formula or a logic, I can not do that in the blog. I can help you only for FF issues.

      Delete
  42. Hi Tilak/Lakshmi,
    Is there a DBI that captures the date from which the current grade is effective for an employee ? eg., If employee A123 got promoted on 1-Jan-2019 and his new grade is effective since then , I want a DBI that returns 1-1-19. "PER_ASG_GRADE_EFFECTIVE_START_DATE" sounds correct but it gives the date on which the grade was created in setup. Please suggest.

    Regards,
    Maya

    ReplyDelete
    Replies
    1. The person grade change happens in assignment so you can use assignment effective start date but the problem is, ASG might have changed for many reasons so that you need to make sure the the changes are due to grade change ( get the previous record compare the grade id works for you ).

      Other option is Seniority date, I have done a blog on that with relation to Grade steps.
      https://tilak-lakshmi.blogspot.com/2018/08/grade-steps-progressions-gsp-fast_9.html. I think seniority date is the right option.

      Delete
  43. HI Lakshmi.
    Good Morning.
    Could you please explain about WSA function uss with an example.

    Thanks
    Shiva G

    ReplyDelete
    Replies
    1. it is already done in https://tilak-lakshmi.blogspot.com/2016/05/communicating-between-fast-formulas.html

      Delete
  44. Hi Tilak and Lakshmi,

    I am unable to view the screenshots which you have placed.
    Can you suggest us which IE version is required to look.

    Thanks,
    Govardhan

    ReplyDelete
    Replies
    1. hi Govardhan,
      Thanks for letting me know. It is not a browser issue, it was caused by blogger.
      I fixed the images now.
      -tilak

      Delete
  45. This comment has been removed by the author.

    ReplyDelete
  46. Here we need date format DD/MM/YYYY only.

    ReplyDelete
  47. Hi All,

    Can someone help me with return data type as 'DATE' . I want to return date type output and format should be 'DD/MM/YYYY/ but it is not working

    DEFAULT FOR L_DEFAULT_VALUE is '1900/01/01' (date)
    DEFAULT FOR PER_ASG_ATTRIBUTE_DATE2 is '1900/01/01'(date)
    L_DATA_TYPE = 'DATE'

    L_PROMOTION_VALUE= 'X'
    L_Assignment_Id = GET_CONTEXT(HR_ASSIGNMENT_ID,0)

    (CHANGE_CONTEXTS (HR_ASSIGNMENT_ID = L_Assignment_Id, EFFECTIVE_DATE=GET_CONTEXT(EFFECTIVE_DATE,'4712/12/31' (date)))

    L_PROMOTION_VALUE = to_char(PER_ASG_ATTRIBUTE_DATE2,'YYYY/MM/DD HH24:MI:SS')
    )
    L_DEFAULT_VALUE = to_date(L_PROMOTION_VALUE,'YYYY/MM/DD')
    L_DATA = ESS_LOG_WRITE( 'Last Promotion Date ' || to_char(L_DEFAULT_VALUE) )

    Return L_DATA_TYPE,L_DEFAULT_VALUE

    ReplyDelete
    Replies
    1. is the given formula working?. The given formula returns the date in different format.
      Well, the answer is you need to return the value in YYYY/MM/DD format from formula. The underlying process change the value into date and display in user preferred format.
      the common question is "it is not working". What is not working?, are you getting value in wrong format or you are not getting value.

      Delete
  48. Hi All,

    Can anyone help me in giving fast formula that flow talent profile to compensation worksheet

    ReplyDelete
  49. Hi Lakshmi,
    I am creating a default and override fast formula for one of the Compensation worksheet columns. Is it possible to reference the value of another worksheet column in this formula ?
    I am not able to find a DBI for this, any suggestions would be appreciated.

    Regards,
    Maya

    ReplyDelete
  50. Hi Tilak-lakshmi,

    Thank you very much for sharing your knowledge and thoughts. i am new to fast formulas just started going through the formulas.

    I have a doubt in below formula logic.

    -----------------------------------------------------------------

    Declare the Input Values
    */
    INPUTS ARE CMP_IV_PLAN_START_DATE (text), CMP_IV_PLAN_END_DATE (text)


    1.l_hr_assign_id = get_context(HR_ASSIGNMENT_ID, -1)
    L_DATA = ESS_LOG_WRITE( 'BEGIN MY_FIRST_CWB_DEFAULT_FF' )
    L_DATA = ESS_LOG_WRITE( 'Start Date :' + CMP_IV_PLAN_START_DATE)
    L_DATA = ESS_LOG_WRITE( 'End Date :' + CMP_IV_PLAN_END_DATE)
    L_DATA = ESS_LOG_WRITE( 'Asg ID :' + TO_CHAR(l_hr_assign_id))


    L_PL_START_DATE = TO_DATE(CMP_IV_PLAN_START_DATE,'YYYY/MM/DD')
    L_PL_END_DATE = TO_DATE(CMP_IV_PLAN_END_DATE,'YYYY/MM/DD')
    L_VALUE = 0
    l_CURR = ' '


    /*
    Determine the First date
    */
    IF (L_PL_START_DATE <> ROUND(L_PL_START_DATE, 'MM')) THEN
    (
    2. L_PL_START_DATE = TRUNC(ADD_MONTHS(L_PL_START_DATE, 1), 'MM')

    ---------------------------------------------------------------------

    1. in get_context(HR_ASSIGNMENT_ID, -1) why we use -1 after HR_ASSIGNMENT_ID

    2 In TRUNC(ADD_MONTHS(L_PL_START_DATE, 1), 'MM') Why we use 1 after L_PL_START_DATE

    can you please explain the logic behind this



    ReplyDelete
    Replies
    1. Welcome to the world of FF.
      >>>>get_context(HR_ASSIGNMENT_ID, -1)
      There is no concept of NULL in Fast Formula therefore you need to define a default value. - 1 is the default value for the context. -1 returned when the context HR_ASSIGNMENT_ID is null.

      >>>> TRUNC(ADD_MONTHS(L_PL_START_DATE, 1), 'MM')
      As per the logic, the plan start date is not first of the month we, need to start the process from the first of next month (it is just a logic, no specific reason used in the example) therefore
      ADD_MONTHS(L_PL_START_DATE, 1) adds a month to the plan start date
      TRUNC(ADD_MONTHS(L_PL_START_DATE, 1), 'MM'), find the first date of the return value of ADD_MONTHS(L_PL_START_DATE, 1), that is first date of the next month.

      Hope this helps.

      Delete
  51. Hi Lakshmi,

    I am new to the total compensation in Fusion and I have a requirement to fetch only the latest element entry values (for around 15 elements)in to the total compensation statement.
    I am trying to fetch element entry date and value through 'Total Compensation Item' type fast formula. but some how not able to succeed.
    Could you please help me in this regard.

    below is my formula: kindly guide me
    /*******************************************************************
    FORMULA NAME : TOTAL_COMP_ITEM_PERFORMANCE_BONUS
    FORMULA TYPE : Total Compensation Item
    DESCRIPTION : Returns one date and one value.
    *******************************************************************/
    DEFAULT_DATA_VALUE FOR PER_HIST_ASG_EFFECTIVE_START_DATE IS '1900/01/01 00:00:00' (date)
    DEFAULT_DATA_VALUE FOR PER_HIST_ASG_EFFECTIVE_END_DATE IS '4712/12/31 00:00:00' (date)
    DEFAULT_DATA_VALUE FOR PER_HIST_ASG_ASSIGNMENT_ID IS 0
    DEFAULT_DATA_VALUE FOR PER_HIST_ASG_EFFECTIVE_LATEST_CHANGE IS 'N'
    DEFAULT_DATA_VALUE FOR PER_HIST_ASG_PRIMARY_FLAG IS 'N'
    DEFAULT_DATA_VALUE FOR PER_HIST_ASG_LEGAL_ENTITY_ID IS 0
    DEFAULT_DATA_VALUE FOR PER_HIST_ASG_LEGAL_EMPLOYER_NAME IS ' '

    DEFAULT_DATA_VALUE FOR ELEMENT_ENTRY_BASE_ELEMENT_NAME IS ' '
    DEFAULT_DATA_VALUE FOR ELEMENT_ENTRY_VALUE IS ' '
    DEFAULT_DATA_VALUE FOR ELEMENT_ENTRY_EFFECTIVE_START_DATE IS '1900/01/01 00:00:00' (date)
    DEFAULT FOR CMP_ASSIGNMENT_SALARY_AMOUNT IS -1
    DEFAULT FOR CMP_ASSIGNMENT_SALARY_DATE_FROM IS '1900/01/01 00:00:00' (date)
    /*=========== INPUT VALUES DEFAULTS BEGIN =====================*/
    INPUTS ARE CMP_IV_PERSON_ID (text), CMP_IV_PERIOD_START_DATE (date), CMP_IV_PERIOD_END_DATE (date)
    DEFAULT FOR CMP_IV_PERSON_ID IS '-1'
    DEFAULT FOR CMP_IV_PERIOD_START_DATE IS '4712/12/31' (date)
    DEFAULT FOR CMP_IV_PERIOD_END_DATE IS '4712/12/31' (date)
    /*============ INPUT VALUES DEFAULTS ENDS =====================*/

    /*=================== FORMULA SECTION BEGIN =================*/
    L_ELEMENT = ELEMENT_ENTRY_BASE_ELEMENT_NAME
    LEGALEMPLOYERS = ' '

    /*LEGALEMPLOYERS = PER_HIST_ASG_LEGAL_EMPLOYER_NAME*/
    ASSIGNMENTS = to_char(get_context(HR_ASSIGNMENT_ID,-1))
    IF L_ELEMENT = 'Performance Bonus' THEN
    (
    IF ELEMENT_ENTRY_BASE_VALUE_NAME = 'Amount' THEN
    (COMPENSATION_DATES = TO_CHAR(ELEMENT_ENTRY_EFFECTIVE_START_DATE, 'YYYY/MM/DD')
    VALUES = TO_CHAR(ELEMENT_ENTRY_VALUE)
    )
    )

    Val = ESS_LOG_WRITE(' employer '+ LEGALEMPLOYERS)
    Val = ESS_LOG_WRITE(' Component Date '+ COMPENSATION_DATES)
    Val = ESS_LOG_WRITE(' Component Value '+ VALUES)
    RETURN COMPENSATION_DATES, VALUES, ASSIGNMENTS
    /*================ FORMULA SECTION END =======================*/

    Thanks alot in advance.

    ReplyDelete
    Replies
    1. Your are initializing variable within if condition. What happens to the variable, if the condition fails?
      Before validating , print(ESS_LOG_WRITE) the L_ELEMENT and ELEMENT_ENTRY_BASE_VALUE_NAME to see if the condition works in the way you desire.
      please be specific when you ask questions, 'not working' 'not succeed' are not helping much. What is the exact output or errors, if so what is the error and what is ur expectation.

      Delete
    2. you are using array dbi, please see my array blog how to handle them. you can not access array like normal dbi

      Delete
    3. Hi Lakshmi,
      Thank you very much for your response.
      leaving the above formula aside, could you please guide me how to get element entry data (latest element entry start date and value)into 'Compensation Item' through formula.
      That would help me .

      Thanks alot!

      Delete
    4. use the right DBI, do not for the range. Eeery
      EE input Values crete a dbi provided u have the right setup.

      Delete
  52. Hi Lakshmi,

    I am using 'Total Compensation Item' type formula. So only entry value DBI available for any specific element entry, but not the element entry start date. Any idea to how to get the element entry start for the same please.

    Thanks

    ReplyDelete
    Replies
    1. in that case you need to use array DBI only, you need iterate through every row and get the right row as per your need

      Delete
    2. Hi Lakshmi, sorry for bugging you. I have critical mile stone and I am just a beginner in fast formula. Please help me where am I doing wrong. Below are my formulas:
      Child Formula:to fetch the element entry start date

      /*****************************************************************************

      FORMULA NAME: XX_TCS_PERF_BONUS_START_DATE

      FORMULA TYPE: Compensation Default and Override

      DESCRIPTION:
      This is the formula to fetch the AU Performance Bonus Element entry start date


      *******************************************************************************/
      DEFAULT FOR PERFORMANCE_BONUS_AMOUNT_ASG_ENTRY_VALUE IS 0
      DEFAULT_DATA_VALUE FOR PAY_PAYROLL_REL_ID is 0
      DEFAULT_DATA_VALUE FOR ELEMENT_ENTRY_ASSIGNMENT_ID IS 0
      DEFAULT_DATA_VALUE FOR ELEMENT_ENTRY_BASE_VALUE_NAME IS ' '
      DEFAULT_DATA_VALUE FOR ELEMENT_ENTRY_BASE_ELEMENT_NAME IS 'Performance Bonus'
      DEFAULT_DATA_VALUE FOR ELEMENT_ENTRY_BASE_VALUE_NAME IS 'NULL'
      DEFAULT_DATA_VALUE FOR ELEMENT_ENTRY_EFFECTIVE_START_DATE IS '1900/01/01' (date)




      L_DEFAULT_VALUE = to_char(0)
      L_DATA_TYPE = 'NONETYPE'

      l_hr_assign_id = get_context(HR_ASSIGNMENT_ID, -1)
      l_eff_date = get_context(DATE_EARNED, '1900/01/01 00:00:00' (date))
      l_pay_assign_id = get_context(PAYROLL_ASSIGNMENT_ID, -1)
      l_effective_date = get_context(EFFECTIVE_DATE,'1900/01/01 00:00:00' (date))


      L_DATA = SET_LOG( 'BEGIN Element Start Date' )
      L_DATA = SET_LOG( 'ASG ID :' + TO_CHAR(l_hr_assign_id ))
      L_DATA = SET_LOG( 'PAY ASG ID :' + TO_CHAR(l_pay_assign_id ))
      L_DATA = SET_LOG( 'Date :' + TO_CHAR(l_eff_date , 'YYYY/MM/DD') )

      /*L_DATE = ' '*/
      /*
      If PERFORMANCE_BONUS_AMOUNT_ASG_ENTRY_VALUE >0 then
      (L_DATE = TO_CHAR(l_effective_date))
      L_DATA = ESS_LOG_WRITE( 'EFFECTIVE_DATE : '+L_DATE) */
      CHANGE_CONTEXTS(PAYROLL_RELATIONSHIP_ID = l_pay_assign_id)
      (
      I = ELEMENT_ENTRY_ASSIGNMENT_ID.LAST(-1)
      WHILE (ELEMENT_ENTRY_BASE_ELEMENT_NAME.EXISTS(I))
      LOOP
      (
      L_DATA = SET_LOG( 'Loop 1. ELEMENT_ENTRY_BASE_ELEMENT_NAME :'+ELEMENT_ENTRY_BASE_ELEMENT_NAME[i] +'
      2. ELEMENT_ENTRY_RGE_BASE_VALUE_NAME :'+ELEMENT_ENTRY_BASE_VALUE_NAME[i])
      IF ELEMENT_ENTRY_BASE_ELEMENT_NAME[I] = 'Performance Bonus'
      AND ELEMENT_ENTRY_BASE_VALUE_NAME[i] = 'Amount'
      THEN
      (
      L_DEFAULT_VALUE = TO_CHAR(ELEMENT_ENTRY_EFFECTIVE_START_DATE[i],'YYYY/MM/DD')

      )
      )
      )
      L_DATA= SET_LOG('ELEMENT_ENTRY_EFFECTIVE_START_DATE: '+ L_DEFAULT_VALUE)
      RETURN L_DATA_TYPE, L_DEFAULT_VALUE

      Delete
    3. Parent Formula:

      /*******************************************************************
      FORMULA NAME : XX_TCS_PERFORMANCE_BONUS_AMOUNT
      FORMULA TYPE : Total Compensation Item
      DESCRIPTION : Fast Formula to determine Performance Bonus amount

      Change History:
      Name Date Comments
      ---------------------------------------------------------------------------------
      07-Aug-2020 Initial Design
      *******************************************************************/
      /*=========== INPUT VALUES DEFAULTS BEGIN =====================*/

      /*=========== INPUT VALUES DEFAULTS ENDS======================*/

      DEFAULT FOR PERFORMANCE_BONUS_AMOUNT_ASG_ENTRY_VALUE IS 0
      DEFAULT FOR ACP_HIRE_DATE is '1900/01/01 00:00:00'(date)
      DEFAULT FOR CMP_IV_PERSON_ID IS '-1'
      DEFAULT FOR CMP_IV_PERIOD_START_DATE IS '4712/12/31' (date)
      DEFAULT FOR CMP_IV_PERIOD_END_DATE IS '4712/12/31' (date)
      DEFAULT FOR CMP_ASSIGNMENT_SALARY_DATE_FROM IS '1900/01/01 00:00:00' (date)

      INPUTS ARE CMP_IV_PERSON_ID (text), CMP_IV_PERIOD_START_DATE(DATE), CMP_IV_PERIOD_END_DATE(DATE)

      LEGALEMPLOYERS = ' '
      L_DATA = ' '
      L_DATE_EARNED = '1951/01/01'(date)
      l_date = ' '
      EXECUTE('XXASG_TCS_PERF_BONUS_START_DATE')
      L_DATA = ESS_LOG_WRITE( 'EFFECTIVE_DATE : '+L_DATE)
      L_DATA = SET_LOG( 'EFFECTIVE_DATE : '+L_DATE)
      l_date = GET_OUTPUT(l_date,TO_CHAR(CMP_ASSIGNMENT_SALARY_DATE_FROM,'YYYY/MM/DD'))


      ASSIGNMENTS = to_char(get_context(HR_ASSIGNMENT_ID,-1))
      /*COMPENSATION_DATES = TO_CHAR(CMP_ASSIGNMENT_SALARY_DATE_FROM, 'YYYY/MM/DD')*/
      /*COMPENSATION_DATES = TO_CHAR(l_date,'YYYY/MM/DD')*/
      COMPENSATION_DATES = l_date
      VALUES = TO_CHAR(PERFORMANCE_BONUS_AMOUNT_ASG_ENTRY_VALUE)
      /*LEGALEMPLOYERS = PER_HIST_ASG_LEGAL_EMPLOYER_NAME*/


      L_DATA = SET_LOG(' employer '+ LEGALEMPLOYERS)
      L_DATA = SET_LOG(' Component Date '+ COMPENSATION_DATES)
      L_DATA = SET_LOG(' Component '+ VALUES)
      RETURN COMPENSATION_DATES, VALUES, ASSIGNMENTS

      Delete
    4. By the way, it is tilak,
      I understand your desperation and you never described what is wrong, r u not getting the result from child formula? is there any error. attach the log.
      I believe the way you problem is in the loop, u just think there last row in the array fits into your condition, if the condition fails, there is not logic. I do not see how u r coming out of loop or decrementing loop.
      please learn to format/indent the code. nobody likes to see unindented code.

      Delete
  53. If you have sample formula to fetch element entry data in to compensation item, could you please share.

    Thank you!

    ReplyDelete
  54. Hello Tilak, I'm a beginner and found your blogs very useful. I've learned more than I have taught in an in-person training. Thank you so much for creating this amazing blog.

    ===========================================================

    I've a doubt, it will be really helpful if you could address this.


    I came across a problem with extract and fast formula. where I'm trying to display a salary_range column for employees

    something like this -

    ________________________________________________
    | person number | Name | Salary | salary_range|
    | 3565 | abhi | 6k | low |
    | 4356 | raju | 28k | mid |
    | 2341 | anuj | 80k | High |
    -------------------------------------------------


    For this, I've written this fast formula -

    /**************************************************/

    Formula Type - Extract Rule
    Effective as on - 1/1/51

    /**************************************************/


    ALIAS CMP_ASSIGNMENT_SALARY_ANNUAL_AMOUNT AS sal_amt

    DEFAULT FOR sal_amt IS 0


    IF(sal_amt <= 10000) THEN
    (

    L_range = 'Low'

    )


    IF(sal_amt >10000 AND sal_amt <= 50000) THEN
    (

    L_range = 'Medium'

    )


    ELSE
    (

    L_range = 'High'

    )

    RETURN L_range

    /**********************************************/



    I don't know what mistake I'm making, !, The fast formula gets compiled, I've used it one of an attribute in my extract.
    but I can't see any output there.


    Thank you again.



    ReplyDelete
    Replies
    1. Mamta,

      all the example of extract rule returns a variable rule_value. try to use the variable rule_value instead of l_range. and let me know if it works or not ( i never wrote extract formula so good to know)
      Second you have a logic issue, you never going to get "low" instead you will get "high" as per your code.

      Delete
    2. Million Thanks to You Tilak,
      Firstly for creating this blog which takes you up from ground zero.
      And secondly for replying this quick!!.

      Thank you so much for your help. Your suggestion worked for me. I can now see some output in my extract.


      And you are correct, my logic has some issues.

      Right now with this code, I can get the LOW and HIGH, But in some places I'm getting range as Medium for smaller values such as 16 and 13.

      I think I'm making mistake while writing the logic for AND.


      What I'm trying to do is .

      Salary < 10000 - LOW
      10000 > Salary < 50000 - Medium
      Salary > 50000 - High


      My current ff code -

      /*******************************

      DEFAULT FOR CMP_ASSIGNMENT_SALARY_ANNUAL_AMOUNT IS 0


      IF(CMP_ASSIGNMENT_SALARY_ANNUAL_AMOUNT <= 10000) THEN (

      rule_value = 'LOW'

      )

      IF(CMP_ASSIGNMENT_SALARY_ANNUAL_AMOUNT > 10000 AND CMP_ASSIGNMENT_SALARY_ANNUAL_AMOUNT <=50000) THEN (

      rule_value = 'MID'

      )

      IF(CMP_ASSIGNMENT_SALARY_ANNUAL_AMOUNT > 50000) THEN (

      rule_value = 'HIGH'

      )

      IF(CMP_ASSIGNMENT_SALARY_ANNUAL_AMOUNT WAS DEFAULTED) THEN (

      rule_value = 'NA'

      )

      RETURN rule_value


      /****************************


      Once again, Thank you :)

      Delete
    3. it is not my job to tell the people how to code, if I were u.

      rule_value = 'NA'

      IF(CMP_ASSIGNMENT_SALARY_ANNUAL_AMOUNT > 50000) THEN (

      rule_value = 'HIGH'

      ) ELSE (

      IF(CMP_ASSIGNMENT_SALARY_ANNUAL_AMOUNT > 10000 ) THEN (

      rule_value = 'MID'

      ) ELSE (

      IF(CMP_ASSIGNMENT_SALARY_ANNUAL_AMOUNT > 0 ) THEN (

      rule_value = 'LOW'
      )
      )


      )





      Delete
    4. anyway, thanks for coming back, hardly few bothers to update the results especially after it is working :) .

      Delete
    5. Hi Tilak, Thank you again for your help.
      What I found is, the dbi CMP_ASSIGNMENT_SALARY_ANNUAL_AMOUNT is not returning the latest salary for some employees, and so the result I'm getting is incorrect for those emoloyees.

      Can you tell me a way to get the latest salary in my ff ?

      Thanks again
      Mamtha

      Delete
    6. That DBI value is extracted as of EFFECTIVE_DATE context. Please print the context in your log, you know when it is extracted.

      Delete
  55. We built a new #HRROItool to realize the maximum value you can drive from your #HCMtechnology with Pixentia.

    Play with our #ROIvaluecalculator and learn how you can impact the metrics that matter.

    https://www.pixentia.com/services/hcm/roi

    ReplyDelete
  56. Hi,

    Got this code from Oracle support Page. But it is not working.
    Can someone please help? Thanks.

    DEFAULT FOR VARIABLE_COMP_AMOUNT_ASG_ENTRY_VALUE IS 0

    DEFAULT_DATA_VALUE FOR ELEMENT_ENTRY_REPORTING_NAME IS 'VARIABLE_COMP_US'

    INPUTS ARE CMP_IV_PLAN_ID (number),
    CMP_IV_PERIOD_ID (number),
    CMP_IV_COMPONENT_ID (number),
    CMP_IV_ITEM_NAME (text),
    CMP_IV_PLAN_START_DATE (date),
    CMP_IV_PLAN_END_DATE (date)

    L_DATA_TYPE = 'NUMBER'
    l_bonus_amount = 0
    l_eff_date = TO_DATE('06/10/2021','MM/DD/YYYY')
    CHANGE_CONTEXTS(DATE_EARNED = TO_DATE('06/10/2021','MM/DD/YYYY'))
    (
    IF (VARIABLE_COMP_AMOUNT_ASG_ENTRY_VALUE WAS NOT DEFAULTED) THEN
    (
    l_bonus_amount = VARIABLE_COMP_AMOUNT_ASG_ENTRY_VALUE
    )
    )
    L_DEFAULT_VALUE = TO_CHAR(l_eff_date,'YYYY/MM/DD') || '*Amount*' || to_char(l_bonus_amount)
    RETURN L_DATA_TYPE, L_DEFAULT_VALUE

    Error Message Formula WF_CMP_TOTAL_INCENTIVE, line 17, variable VARIABLE_COMP_AMOUNT_ASG_ENTRY_VALUE can't be used in the DEFAULT statement.

    ReplyDelete
    Replies
    1. there is no DBI called "VARIABLE_COMP_AMOUNT_ASG_ENTRY_VALUE". You need to find the right dbi from element entry. I guess the "variable" means the name of the element

      Delete
    2. Thank you very much for the reply. Can you please share how do I find the DBI from Element Entry? yes, the element name is 'Variable Comp' and Input value name is 'Amount'. I'm trying to follow this Oracle document https://support.oracle.com/knowledge/Oracle%20Fusion%20Applications/1565204_1.html

      Thanks

      Delete
    3. the DBI are created with the same name and some additions.
      You can use the Element name to search the DBI in fast formulas -> Database Items

      Delete
    4. But unformtunately none of the elements i'm able to search from the Fast formula page. So does it require any process to be run to make it appear there?

      Delete
  57. hi, can you help me how to default datte as null ? instead of 0001:01:01

    ReplyDelete
    Replies
    1. there is no concept of null in formula, why do you want to have a null date?, if you let me know i can try to find an answer.

      Delete
  58. Does anyone have a sample fast formula to bring seniority date configured at person level to the worksheets of compensation plan?the return value will be date type and the type will be compensation default and over ride.

    ReplyDelete
    Replies
    1. Did you read the blog on aug, 2018. https://tilak-lakshmi.blogspot.com/2018/08/grade-steps-progressions-gsp-fast_9.html

      Delete
  59. Does anyone have a fast formula to pull organization tree attributes in compensation worksheet?

    ReplyDelete
  60. I need a fast formula to bring organization tree attributes in compensation worksheet.

    ReplyDelete
  61. Hi can you show some payroll fast formula i.e how to calculate basic pay, housing and transport etc.

    ReplyDelete
  62. Hi,I have an element for which user will be entering percentage.Amount flowing to payroll should be percentage*employee salary. Can someone help me how I can achieve this with a fast formula and if any sample code is available ?

    ReplyDelete