Tuesday, October 31, 2017

Fast Formula – Introduction to Compensation Workbench

Fast Formula – Introduction to Compensation Workbench (CWB), Salary (CMP), Total Compensation (TCS), and Grade Step Progression (GSP).

In section 1, we went over the basics of the Fast Formula engine and its components and in section 2, we showed the steps to create a simple Fast Formula. If you are new to Fast Formula, please check these sections before proceeding further on this section.
In this section, we will introduce you to a real life Fast Formula of product Compensation.
Formulas are like User Defined Functions. To develop any Functions, the developer needs to understand three basic things.
  1. What is available? (Global variables, IN parameters or any other cached data)
  2. What is expected? (Return values,  OUT parameters , cached data or global variables)
  3. How to go from available to expected? In other words, business logic and technical know-how.
We will now discuss about what is available such as Formula Types, Context, Input values in Fast Formula for products like CMP, TCS and GSP and what is expected such as Return variables and values.
Formula Types:
Compensation (CMP/TCS/GSP) has provided 10 Formula Types (may be more or less depending on the release)
Formula Type
Description
Usage
Compensation Currency Selection
Compensation Currency Selection Rule
This Formula Type is used for determining Currency at component Level.
Compensation-Manage Plan->Configure Compensation Component -> Edit Component
Compensation Default Access Level
Compensation Default Access Level Rule
By this type, customer can define customized access level in hierarchy and reviewer.
Compensation-Manage Plan->Configure Hierarchy
Compensation Default and Override
Compensation Default and Override Rule
This Formula Type is attached in CWB attribute values to provide the value for the attribute
Compensation->Manage Plan ->Configure Work Sheet-Configure tab -> detail table-> properties
Compensation End Date
Compensation End Date Rule
This is created for Variable compensation. I believe it is not implemented yet.
Compensation Hierarchy Determination
Compensation Hierarchy Determination
Compensation-Manage Plan->Configure Hierarchy
Compensation Person Selection
Compensation Person Selection Rule
This Formula type is used by Work Bench and Total Compensation ESS process to Filter the people.
Compensation->Generate Compensation.
Compensation->Run Batch Process.
Compensation Start Date
Compensation Start Date Rule
This is created for Variable compensation. I believe it is not implemented yet.
Salary Progression Date Determination Rule
Salary Progression Date Determination Rule to determine the date
This formula type is attached in Assignment or Salary update date for the GSP process.
Compensation -> Manage Progressions Ladder
Salary Progression Rate Calculation Rule
Salary Progression Rate Calculation Rule to determine the Salary
This formula type is attached in  New rate calculation for GSP
Compensation -> Manage Progressions Ladder
Total Compensation Item
Total Compensation Item Rule
This formula type is attached in Total Compensation Item. Allows providing value for Total Compensation Item.
Compensation->Manage Compensation Item
Context:
Compensation (CMP/TCS/GSP) has provided 16 contexts.  As of now, all Formula Types of CMP/TCS/GSP support the same set of context. I found this very interesting and this has made it easy to deal with the different Formula Types of the same product.
Context
Type
Description
DATE_EARNED
Date
Effective date of the process, if person terminated, termination date
EFFECTIVE_DATE
Date
Effective date of the process, if person terminated, termination date
HR_ASSIGNMENT_ID
Number
Assignment Id, (primary Assignment for TCS)
PERSON_ID
Number
Person Id
HR_TERM_ID
Number
Term id of the assignment ( primary Assignment’s Term ID for TCS)
GRADE_ID
Number
Grade of the Assignment ( primary Assignment’s Grade ID for TCS)
GRADE_RATE_ID
Number
Grade Rate of the Assignment ( primary Assignment’s Grade Rate ID for TCS)
JOB_ID
Number
Job of the Assignment ( primary Assignment’s Job ID for TCS)
LEGISLATIVE_DATA_GROUP_ID
Number
LDG of the Assignment ( primary Assignment’s LDG ID for TCS)
ORGANIZATION_ID
Number
Organization of the Assignment ( primary Assignment’s Organization ID for TCS)
PAYROLL_ASSIGNMENT_ID
Number
Payroll Assignment of the HR assignment ( primary Assignment’s Payroll Assignment ID for TCS)
PAYROLL_RELATIONSHIP_ID
Number
Payroll Relation of the HR Assignment (primary Assignment’s Payroll Relation ID for TCS)
PAYROLL_TERM_ID
Number
Payroll Term of the HR Assignment (primary Assignment’s Payroll Term ID for TCS)
END_DATE
Date
Plan/Statement period start
START_DATE
Date
Plan/Statement period end date
COMPENSATION_RECORD_TYPE
String
This is not passed by the product. User can defined the contest in the formula for using External Data
Note:  The Fast Formula engine is designed in such way that the context is set only when the Fast Formula uses the context. When I say “used”, it may be when you are directly calling a function, GET_CONTEXT, NEED_CONTEXT, CHANGE_CONTEXTS  or  CONTEXT_IS_SET or indirectly when using a DBI.
In our example, in the previous section, we neither used a DBI nor a context function and therefore no Context was passed to the Formula.  We will discuss this in detail in the next sections.
Input Values: Input values are the information that are passed by the product to Formula engine in addition to Context. Like Context, the Input values are passed only if the input values are used in the Formula. Unlike Context, the Compensation passes different set of Input values to the formula.      
The list of the formula type and the context are as follows (may be more or less depending on the release).


Formula Type Name
Input values
Type
Format
Compensation Currency Selection
CMP_IV_PLAN_ID
TEXT
CMP_IV_PERIOD_ID
TEXT
CMP_IV_COMPONENT_ID
TEXT
CMP_IV_PLAN_START_DATE
TEXT
CMP_IV_PLAN_END_DATE
TEXT
CMP_IV_PLAN_ELIG_DATE
TEXT
CMP_IV_PERFORMANCE_EFF_DATE
TEXT
CMP_IV_PROMOTION_EFF_DATE
TEXT
CMP_IV_XCHG_RATE_DATE
TEXT
CMP_IV_PLAN_EXTRACTION_DATE
TEXT
Compensation Default and Override
CMP_IV_PLAN_ID
TEXT
CMP_IV_PERIOD_ID
TEXT
CMP_IV_PLAN_START_DATE
TEXT
CMP_IV_PLAN_END_DATE
TEXT
CMP_IV_PLAN_ELIG_DATE
TEXT
CMP_IV_PERFORMANCE_EFF_DATE
TEXT
CMP_IV_PROMOTION_EFF_DATE
TEXT
CMP_IV_XCHG_RATE_DATE
TEXT
CMP_IV_XCHG_RATE_DATE
TEXT
CMP_IV_ITEM_NAME
TEXT
CMP_IV_COMPONENT_ID
TEXT
CMP_IV_PLAN_EXTRACTION_DATE
TEXT
Compensation Hierarchy Determination
CMP_IV_PLAN_ID
TEXT
CMP_IV_PERIOD_ID
TEXT
CMP_IV_PLAN_START_DATE
TEXT
CMP_IV_PLAN_END_DATE
TEXT
CMP_IV_PLAN_ELIG_DATE
TEXT
CMP_IV_PERFORMANCE_EFF_DATE
TEXT
CMP_IV_PROMOTION_EFF_DATE
TEXT
CMP_IV_XCHG_RATE_DATE
TEXT
CMP_IV_ASSIGNMENT_ID
TEXT
CMP_IV_PLAN_EXTRACTION_DATE
TEXT
Compensation Person Selection
CMP_IV_PLAN_START_DATE
TEXT
YYYY/MM/DD
CMP_IV_PLAN_END_DATE
TEXT
YYYY/MM/DD
CMP_IV_PLAN_ELIG_DATE
TEXT
YYYY/MM/DD
CMP_IV_PLAN_EXTRACTION_DATE
TEXT
YYYY/MM/DD
CMP_IV_PERFORMANCE_EFF_DATE
TEXT
YYYY/MM/DD
CMP_IV_PROMOTION_EFF_DATE
TEXT
YYYY/MM/DD
CMP_IV_XCHG_RATE_DATE
TEXT
YYYY/MM/DD
CMP_IV_PERIOD_ID
TEXT
Total Compensation Item
CMP_IV_PERSON_ID
Number
CMP_IV_PERIOD_START_DATE
Date
CMP_IV_PERIOD_END_DATE
Date
CMP_IV_STMT_ID
Number
CMP_IV_PERIOD_ID
Number
CMP_IV_ITEM_NAME
TEXT
Compensation Person Selection (TCS)
CMP_IV_PERSON_ID
TEXT
CMP_IV_EFFECTIVE_DATE
TEXT
YYYY/MM/DD
CMP_IV_PERIOD_START_DATE
TEXT
YYYY/MM/DD
CMP_IV_PERIOD_END_DATE
TEXT
YYYY/MM/DD
CMP_IV_STMT_ID
TEXT
CMP_IV_PERIOD_ID
TEXT
The following are array input values for TCS Item Formula. Since the TCS item Formula is executed for a person and only primary assignment is passed as context, these array input values are introduced in the latest releases to pass all the assignment of a person and its related information to the fast formula as input values. Please check with the TCS document for the availability of these input values.
CMP_IVR_ASSIGNMENT_ID
NUMBER_NUMBER
CMP_IVR_TERM_ID
NUMBER_NUMBER
-1 in case of null
CMP_IVR_PAY_ASSIGNMENT_ID
NUMBER_NUMBER
-1 in case of null
CMP_IVR_PAY_TERM_ID
NUMBER_NUMBER
-1 in case of null
CMP_IVR_PAY_RELATION_ID
NUMBER_NUMBER
-1 in case of null
Compensation Default Access Level
CMP_IV_PLAN_START_DATE
Text
CMP_IV_PLAN_END_DATE
Text
CMP_IV_PLAN_ID
Text
CMP_IV_PERIOD_ID
Text
CMP_IV_PLAN_ELIG_DATE
Text
CMP_IV_PLAN_EXTRACTION_DATE
Text
CMP_IV_PERFORMANCE_EFF_DATE
Text
CMP_IV_PROMOTION_EFF_DATE
Text
CMP_IV_XCHG_RATE_DATE
Text
CMP_IV_HIERARCHY_TYPE
Text
Salary Progression Date Determination Rule
CMP_IV_GRADE_LADDER_ID
 Number
LEGISLATIVE_DATA_GROUP_ID
 Number
CMP_IV_ASSIGNMENT_ID
 Number
CMP_IV_PERSON_ID
 Number
CMP_IV_GRADE_ID
 Number
CMP_IV_GRADE_RATE_ID
 Number
CMP_IV_GRADE_STEP_ID
Number
Salary Progression Rate Calculation Rule
CMP_IV_GRADE_LADDER_ID
 Number
LEGISLATIVE_DATA_GROUP_ID
 Number
CMP_IV_ASSIGNMENT_ID
 Number
CMP_IV_PERSON_ID
 Number
CMP_IV_GRADE_ID
 Number
CMP_IV_GRADE_RATE_ID
 Number
CMP_IV_GRADE_STEP_ID
 Number

In case, the date format is not defined for the date input value, you need to use the default (Database) date format. In case you do not know the default date format, you can write the data in your log file to find the date format.
Return Value/Variable:
The following list is the expected return values or variables from the CWB/TCS/GSP Formula Types.
Formula Type Name
OUTPUT
Compensation Currency Selection
No restriction, Customer should make sure what  they return is  a currency code


Compensation Default and Override
In previous release, the expected variables are
L_DATA_TYPE, L_DEFAULT_VALUE
L_DATA_TYPE determine the type of the  value such as CHAR, NUMBER, DATE
L_DEFAULT_VALUE holds the return value.
In the recent releases, you do not need to return the data type. It is determined from the attribute where the Formula is attached. Therefore, there is no restriction on the variable name.
The Date value must be returned in YYYY/MM/DD format.


Compensation Hierarchy Determination
There are three  options
1)        Return Person id and Assignment id in variable L_PERSON_ID and  L_ASSIGNMENT_ID
2)        Pass Person Number in
L_PERSON_NUMBER
3)        Pass assignment number in L_ASSIGNMENT_NUMBER
In case you want to pass assignment id or person id as null, use -999


Compensation Person Selection
The Return value must be either ‘Y’ or ‘N’




Total Compensation Item
TCS Item formula allows to return multiple rows by  delimiting values with ‘;’
The Required values are date and values. The date and values should be returned in variable, COMPENSATION_DATES, VALUES.
The date should be returned in  YYYY/MM/DD format.
Other optional values are assignment id, legal employer id  should be returned in variable,
ASSIGNMENTS, LEGALEMPLOYERS.
The latest release supports returning array instead of delimited values. The array should use the same variables name as above.


Compensation Default Access Level
This formula supports the values.
UPDATABLE
NOACCESS
READONLY


Salary Progression Date Determination Rule
Return date value in YYYY/MM/DD format


Salary Progression Rate Calculation Rule
Supports only numeric value



This concludes the introduction to the Compensation Product Fast Formulas. We will start with a real life example in our next section. If you have any questions, please let add them in the comments.