Fast Formula is made up of 5 sections:
· Alias Section (optional)
· Default Section
· Inputs Section
· Calculation Section
· Return Section
Syntax:
· ALIAS varname1 AS varname2
Where varname1 is the database item or the global value and varname2 is a unique name not known to the system.
Alias can be used for database items or global values.
· DEFAULT FOR varname1 IS constant
Where varname1 is the input value or the database item and constant is the constant value matching the datatype of the vaname1.
Default statement is used to set default value for an input value or database item. The formula uses the default value if the database item is empty or no input value is provided when you run the formula.
· INPUTS ARE vaname1(datatype), varname2 (datatype)
To pass input values from the element into the formula.
Datatype could be date, text or numeric.
To pass the element input values to the formula during a payroll run you define an input statement.
Note: If the formula uses the input values of other elements, it must access the database items for them.
Inputs Example:
Inputs are Hours_Worked
Default is Numeric. If date or text specify it in Input statement.
Inputs are start_date (date)
Inputs are err_messages (text)
If you are using a database item, then use the exact name as specified in the database item list.
· Other statements
Assignments (A = Rate)
Varname = Expression
IF ……THEN …….ELSE statement
Note: There is no END IF in fast formulas.
· RETURN result_var
Where result_var contains resulting value of the calculation process.
Varibales:
Can be local or global.
Local variables exists only in one formula. And global values are date tracked.
A formula can change only the value of the local variables and not the global values and the database items.
There is a special type of condition called WAS DEFAULTED.
Ex:
DEFAULT FOR hourly_rate IS 3.00
X=hours_worked * hourly_rate
IF hourly_rate WAS DEFAULTED
THEN
MESG = ‘Warning: Hourly rate is defaulted’
In the above example if database item hourly_rate is empty(NULL) then the formula uses the default value of 3.00 and issues a warning message.
You can combine conditions using the logical operators AND ,OR, NOT.
Priority: 1.NOT
2.AND
3.OR
Syntax for IF condition:
IF condition THEN
(
……..
)
ELSE
(
………
)
There are special functions that convert variables from:
· Numbers to text (TO_TEXT or TO_CHAR)
· Dates to Text (TO_TEXT)
· Text to Date (TO_DATE)
· Text to Number (TO_NUM)
Global Values:
You can use global values as variables in the formulas by simply referring to the global value by name. You can never change a global value using a formula. You can change global values in the global windows. Global values are date tracked so that you can make date effective changes ahead of time. Global values are available to all forms within a business group.
How to define a global value:
1) Set your effective date to the date when you want to begin using the global value.
2) Enter a name ,data type and value. You can also enter description.
Database Items:
Two main types:
· Static database items: are pre-defined. Include standard type of information such as sex, birth date, work location of an employee or start and end dates of the payroll period.
· Dynamic database items: are generated from your definitions of
-Elements
-Balances
-Absence types
-Grade rates and Pay scale rates
-Flexfield segments
If the variable is local it does not contain a value when it is first used in the formula. Therefore a value must be assigned before you use it in a condition or expression. If you do not assign a value, Oracle fast formula fails.
Fast Formula Tables:
Prefixed with FF_
Formula Result Rules:
Possible results of formula are:
· The run result (pay value) of the element
· An indirect result or an update for the payroll run to send as an Entry or an Update to the input value of another element, to be processed later in the run.
· Messages to be issued to the user.
· A stop flag that puts an end date on a recurring entry for the formula’s element or another element, to stop processing of the entry after the end date.
Note: Stop flag is used to prevent processing in subsequent runs.
Balances:
Balances are made up of:
· Balance Type
· Balance Feeds
· Balance Dimensions
· Defined Balance
-Calculated Balances
-Latest Balances
Balance Feeds:
Define the input values that may “feed” (contribute to) a balance. The feed is associated with the scale, which always takes the value of [1] (adds to balance) or [-1] (subtracts from balance).
Balance Dimensions:
Describes the “span” of the balance it is associated with. The span is the period of time over which the balance is summed.
Latest Balances:
A latest balance is a record on the database that stores the current value of a particular balance.
Latest Balance consists of:
· Assignment Latest Balance
· Person Latest Balance
Text Functions:
· GET_TABLE_VALUE
· GREATEST
· LEAST
· LENGTH
· SUBSTRING
· UPPER
Numeric Functions:
· ABS
· FLOOR
· GREATEST
· LEAST
· ROUND
· ROUNDUP
· TRUNC
Date Functions:
· ADD_DAYS
· ADD_MONTHS
· ADD_YEAR
· GREATEST
· LEAST
· DAYS_BETWEEN
· MONTHS_BETWEEN
Data Functions:
· TO_CHAR
· TO_DATE
· TO_NUMBER
· TO_TEXT
Other Types of Formulas:
· Element Skip Rules
· Element Entry Validation
Element Skip Rules:
If your payroll policies require periodic or conditional processing of an element, you can write a formula to define when the run should process the element and when it should skip it. You can associate only one element skip rule formula with each element. You must write and validate the formula before you define the element so that you can select the formula from a list on the element window.
Select formula type Element Skip in the formulas window. The formula must set and return a local variable of type text and this variable must be called skip_flag. If the returned value of skip_flag is ‘Y’ all the processing of the element is skipped. Otherwise the element processes as normal.
Ex: IF union_fees_paid > 10000
THEN
Skip_flag = ‘Y’
ELSE
Skip_flag=’N’
RETURN skip_flag
Element Entry Validation:
You must write and validate the formula before you define the element or table so that you can select the formula from a list in the element input value window or Columns window.
· There must be one input value of type text and it must be called entry_value.
· The formula must set and return a local variable giving the status of the validation (success or error). This variable must be called formula_status and have the value ‘S’ (success) or ‘E’ (error).
Optionally the formula can also return a text variable giving an explanatory message. Returned message variable must be called formula_message and can contain any text. It can be returned with both successful and unsuccessful statuses. Formula must not return any other results.
Ex: INPUTS ARE entry_value (text)
IF TO_NUM(entry_value) > 200000
THEN
(
formula_status = ‘E’
formula_message = ‘Too much money.Try again’
)
ELSE
(
formula_status=’S’
formula_message = ‘Fine’
)
RETURN formula_status,formula_message
Comments
How do you handle need for database item in oracle fusion ...
There is some issue with getting database items in Fast Formula ...
RSS feed for comments to this post