Rates Defined by Formula

You can define rates based on Fast Formula.

Let's consider an example where an employee can work in a job at a higher grade than their normal job. The rate paid to that employee is based on different criteria and includes rules, such as the minimum rate must be at least 1.00. You can use a formula to step up the grade to the next level and to return the rate assigned to that higher grade.

On the Rate Definition page, Calculation Formula field, select the HCM Rates Calculate Value formula type. The formula type supports contexts, such as assignment, payroll relationship, and job. You can select and create the correct formula for rate definitions from all standard database items.

Write a Formula

You can write your own formula when the formula type is HCM Rates Calculate Value.

The formula has certain inputs and return value, but the rate always returns these values:

  • Monetary Amount

  • Currency

  • Periodicity

Note:

Formula-based rates are only supported for rate calculations in the payroll run.

Examples

In this formula, the return values set to 65.23, but you can add the required logic to calculate the rate return values.

Default for value_name is EMPTY_TEXT_NUMBER
default for value_value is EMPTY_TEXT_NUMBER 
default for value_datatype is EMPTY_TEXT_NUMBER 

inputs are 

          value_name (text_number), 
           value_value (text_number), 
           value_datatype (text_number), 

AMOUNT = 65.23 
CURRENCY = 'USD'
PERIODICITY = 'YEAR' 
 return AMOUNT, CURRENCY, PERIODICITY 

Let's consider another example where the formula returns a rate based on a job. You can use this formula to calculate a rate value when an employee works in a job at a higher grade than at their normal job.

default for value_name is EMPTY_TEXT_NUMBER
default for value_value is EMPTY_TEXT_NUMBER
default for value_datatype is EMPTY_TEXT_NUMBER

default for PER_ASG_ELIG_JOBS_CURRENCY is 'UNKNOW'
default for PER_ASG_ELIG_JOBS_END_DATE is '0001/01/01 00:00:00' (date)
default for PER_ASG_ELIG_JOBS_FREQUECY is 'YEARLY'
default for PER_ASG_ELIG_JOBS_FROM_DATE is '0001/01/01 00:00:00' (date)
default for PER_ASG_ELIG_JOBS_JOB_CODE is 'UNKNOW'
default for PER_ASG_ELIG_JOBS_JOB_ID is 0
default for PER_ASG_ELIG_JOBS_JOB_NAME is 'UNKNOWN'
default for PER_ASG_ELIG_JOBS_MANUAL_RATE is 0
default for PER_ASG_JOB_ID is 0

inputs are
           value_name (text_number),
           value_value (text_number),
           value_datatype (text_number)

    AMOUNT = 0
    PERIODICITY = 'YEARLY'
    CURRENCY = 'USD'

    l_log = PAY_INTERNAL_LOG_WRITE('[RATE_FML] - count is                  : ' || to_char(value_name.count))
    l_log = PAY_INTERNAL_LOG_WRITE('[RATE_FML] - count2 is                 : ' || to_char(value_value.count))
    l_log = PAY_INTERNAL_LOG_WRITE('[RATE_FML] - count3 is                 : ' || to_char(value_datatype.count))

    l_job_id = PER_ASG_JOB_ID
    l_log = PAY_INTERNAL_LOG_WRITE('[RATE_FML] - l_job_id is                  : ' || to_char(l_job_id))

    i = 0
    while (i < value_name.count) loop
    (
        l_log = PAY_INTERNAL_LOG_WRITE('[RATE_FML] - name is                  : ' || value_name[i])
        l_log = PAY_INTERNAL_LOG_WRITE('[RATE_FML] - value is                 : ' || value_value[i])
        l_log = PAY_INTERNAL_LOG_WRITE('[RATE_FML] - datatype is              : ' || value_datatype[i])

        if(value_name[i] = 'PER_ASG_JOB_ID') then
        (
            l_job_id = to_num(value_value[i])
            l_log = PAY_INTERNAL_LOG_WRITE('[RATE_FML] - l_job_id has been set with          : ' || to_char(l_job_id))
        )

        i = i + 1
    )

    CHANGE_CONTEXTS(JOB_ID = l_job_id)
    (
        l_t_dummy = PER_ASG_ELIG_JOBS_CURRENCY
        l_log = PAY_INTERNAL_LOG_WRITE('[RATE_FML] - l_t_dummy is                  : ' || l_t_dummy)
        if(l_t_dummy != 'UNKNOW') then
        (
            CURRENCY = l_t_dummy
        )

        l_dt_dummy = PER_ASG_ELIG_JOBS_END_DATE
        l_log = PAY_INTERNAL_LOG_WRITE('[RATE_FML] - l_dt_dummy is                  : ' || to_char(l_dt_dummy))

        l_t_dummy = PER_ASG_ELIG_JOBS_FREQUECY
        l_log = PAY_INTERNAL_LOG_WRITE('[RATE_FML] - l_t_dummy is                  : ' || l_t_dummy)
        if(l_t_dummy != 'UNKNOW') then
        (
            PERIODICITY = l_t_dummy
        )

        l_dt_dummy = PER_ASG_ELIG_JOBS_FROM_DATE
        l_log = PAY_INTERNAL_LOG_WRITE('[RATE_FML] - l_dt_dummy is                  : ' || to_char(l_dt_dummy))

        l_t_dummy = PER_ASG_ELIG_JOBS_JOB_CODE
        l_log = PAY_INTERNAL_LOG_WRITE('[RATE_FML] - l_t_dummy is                  : ' || l_t_dummy)

        l_n_dummy = PER_ASG_ELIG_JOBS_JOB_ID
        l_log = PAY_INTERNAL_LOG_WRITE('[RATE_FML] - l_n_dummy is                  : '||to_char(l_n_dummy))

        l_t_dummy = PER_ASG_ELIG_JOBS_JOB_NAME
        l_log = PAY_INTERNAL_LOG_WRITE('[RATE_FML] - l_t_dummy is                  : ' || l_t_dummy)

        l_n_dummy = PER_ASG_ELIG_JOBS_MANUAL_RATE
        l_log = PAY_INTERNAL_LOG_WRITE('[RATE_FML] - l_n_dummy is                  : '||to_char(l_n_dummy))
        if(l_n_dummy > 0) then
        (
            AMOUNT = l_n_dummy
        )
    )

return AMOUNT, PERIODICITY, CURRENCY