Oracle HRMS Fast Formula - Tutorial

Oracle FastFormula is a simple way to write formulas using English words & basic mathematical functions. You can use information from your database in formulas without learning the database structure or a programming language. Common tables SELECT * FROM all_objects WHERE object_type = 'TABLE' AND object_name LIKE 'FF%' FF_FUNCTIONS FF_FUNCTION_PARAMETERS FF_FORMULAS_F FF_FORMULA_TYPES FF_DATABASE_ITEMS FF_GLOBALS_F Uses of Oracle FastFormula In HRMS, Oracle FastFormula is used for validation, to perform calculations, and to specify rules. Here are some examples. In Payroll, you use formulas to: ‡ Validate element inputs ‡ Calculate element pay values and run results during payroll processing ‡ Specify the rules for skipping an element during payroll processing ‡ Perform legislative checks during a payroll run In Compensation and Benefits Management, you use formulas to: ‡ Specify the rules for Paid Time Off accrual plans, such as how much time is accrued and over what period, when new starters are eligible to begin accruing time, and how much time can be carried over to the next accrual term. ‡ Define custom calculations for benefits administration. ‡ Calculate the duration of an absence given the start and end dates and times. ‡ Create rules for benefits administration such as eligibility determination.

functions. Oracle FastFormula needs to get values for the variables hours_worked and hourly_rate.In People Management. Both variables and constants can be one of three data types: ‡ Numeric ‡ Text ‡ Date 4) Types of Input. applicants. You could write this formula: wage = hours_worked * hourly_rate RETURN wage The first line is an Assignment statement that simply assigns a value to the element Wage. fast formulas are used to: ‡ Check that element entry values are valid for an assignment ‡ Specify the criteria for including an assignment in an assignment set and to edit assignment sets ‡ Configure the people management templates in a number of ways such as supplying additional information to be available from fields on the template and validating field entries. 3) Data Types. 2) Constants and Variables. and contingent workers. suppose you wanted to calculate the pay value for the element Wage by multiplying the number of hours an employee works each week by hourly rate. To start with a simple example. 1) Assignment and Return Statements. such as: wage = 200. The second line is a Return statement that passes back the Wage value to the payroll run. ‡ Define collective agreements ‡ Generate custom global person number sequences for employees. These can include assignment statements. nested expressions. the Wage value is calculated. To calculate the Wage value. Values for the variables hours_worked and hourly_rate can be populated using three ways: . Components of Formulas Formulas are made up of a number of different components. In this example. and conditions. different types of input including database items. but it could be a constant value.

In the Formulas window. you define an Inputs statement. as follows: INPUTS ARE hours_worked wage = hours_worked * hourly_rate RETURN wage The name you use in the Inputs statement must be the same as the name of the element input value. ‡ Using global values.‡ Receiving them as input when the formula is called. A database item has a label. Dynamic database items are created by Oracle HRMS processes whenever you define new elements or other related entities. suppose that hours_worked is an input value to the element Wage. Static database items are shipped with the system and you cannot modify them. These items include both information unique to your enterprise. you must tell Oracle FastFormula whether it is text or date. There are two types of DB Items: Static and Dynamic. To pass the element input values to the formula during a payroll run. you simply refer to it by name. Element Database Items: . To use a value passed to the formula at run time. and multiple words must be joined by underscores. This is an example of a database item. or special piece of code. telling Oracle FastFormula the path to take to access the data. which you hold in flexfield segments & standard information such as assignment numbers and grades etc. Input Statements In our Wage example. You can browse through lists of database items in the Formulas window. you pick database items from a list. For example: INPUTS ARE start_date (date) Database Items Suppose that hourly_rate is a standard rate taken from the Grade Rates table. which you enter in the Globals window. you must write an Inputs statement. In this example. the input value hours_worked is numeric. If the input value is not numeric. To use a database item or global value in your formula. ‡ Finding the values in the database from database items.

RTRIM. For example: ANNUAL_BONUS = trunc(((((salary_amount/100)* bonus_percentage)/183)*(days_between(end_period_date.LEAST LENTH. To ensure easy recognition of these items.LOWER. such as Company Name. the variable wage itself is a local variable. and you can nest expressions to create more complex calculations. In the Wage example. Oracle HRMS runs a process to create a number of related database items for it.TRUNC.FLOOR. ETC( For full list refer the Fast Formula Guide). CALCULATE_HOURS_WORKED. There are special functions that convert variables from: ‡ numbers to text (TO_TEXT) ‡ dates to text (TO_TEXT) ‡ text to date (TO_DATE) ‡ text to number (TO_NUM) Nested Expressions Each function or calculation is one expression. You define the global value and change its value using the Globals window. Global Variables Use global values to store information that does not change often.INITCAP. You can change the value of a local variable by assigning it a value in an Assignment statement.LTRIM.TRANSLATE. start_date) + 1)).REPLACE SUBSTRING. Local Variables Local variables exist in one formula only. the process adds the element name to each one. It also creates further database items for each pay and input value you use .When you define a new element. or company-wide percentages used to calculate certain types of bonus. 2) Oracle FastFormula begins calculating inside the brackets and from left to right. in the following steps: . It receives a value within the formula by the Assignment statement: wage = hours_worked * hourly_rate Functions Oracle FastFormula provides functions that manipulate data in different ways.ROUND. You must use brackets to make clear to Oracle FastFormula the order in which the calculations are performed. GREATEST. but you refer to frequently.ABS.INSTR.

However you may need to perform different calculations depending on the particular group of employee assignments. * bonus_percentage 3. * 5. and it is calculated in the same way for every assignment.00 and issues a warning message. the formula uses the default value of 3. Combined Conditions You can combine conditions using the logical operators AND.1. if the database item hourly_rate is empty (NULL). NOT.. days_between (end_period_date. 1. You can do this by incorporating conditions in your formula. or some other factors. / 183 4. start_date) 5.2) Incorporating Conditions In Wage element example. 4. + 1 6. only one value is returned. Use this to test whether a default value has been placed in an input value or database item. Default values are placed using the Default statement. 7. TRUNC(6. OR.00 X = hours_worked * hourly_rate IF hourly_rate WAS DEFAULTED THEN MESG = µWarning: hourly rate defaulted¶ In this example. Simple Conditions For example: IF age < training_allowance =" 30" training_allowance =" 0"> IF (DAYS_BETWEEN(end_period_date. start_date)+1) >= threshold_value WAS DEFAULTED There is a special type of condition called WAS DEFAULTED. or the time of the year. salary_amount/100 2. 3. Commenting Formula . 2. For example: DEFAULT FOR hourly_rate IS 3.

Alias Statements Sometimes DB Item names are too long to conveniently use in a formula. For example. If hourly_rate is empty (NULL) in the database. in which case it issues a warning message. This causes Oracle FastFormula to return a syntax error. The formula uses the ¶WAS DEFAULTED¶ test to detect when a default value is used. Set up an alternative shorter name to use within the formula. For example: ALIAS as_qualifying_length_of_service AS as_los In the rest of the formula. The Database Items window appears when you choose the Show Items button on the Formulas window.00. the formula uses the default value of 3. as_los) as if it were the actual variable (as_qualifying_length_of_service). Important: You must use the Default statement for database items that can be empty. For example: DEFAULT FOR hourly_rate IS 3. The Database Items window includes a check box labeled Default Required. The formula uses the default value if the database item is empty or no input value is provided when you run the formula.00 for the database item hourly_rate. Default Statements It is used to set a default value for an input value or a database item. This check box is checked for database items that can be empty. you can use the alias (in this example. you can name the formula as: /* Formula: Calculates Duration of Absence */ Caution: Do not put a comment within a comment.00 X = hours_worked * hourly_rate IF hourly_rate WAS DEFAULTED THEN MESG = ¶Warning: hourly rate defaulted¶ This example sets a default of 3. .You must include comments in your formulas to make them easier to read and understand what the formula does.

The term . ‡ Run-time errors occur when a problem arises while a formula is running. The basic Oracle FastFormula errors that can occur at run-time are: ‡ Uninitialized Variables: An uninitialized local variable is one that has no value when the formula runs. An error message explains the nature of the error. you can run the concurrent program ³Bulk Compile Formulas process´ in the Submit Requests window. The usual cause is a data problem. Common verify-time errors are syntax errors resulting from typing mistakes.How to Compile FastFormula? After creating or editing a formula in the Formula window. either in the formula or in the application database. Formula Errors There are two types of error that can occur when using Oracle FastFormula: ‡ Verify-time errors occur in the Formulas window when you run the formula verification. choose the Verify button to compile it. If you need to compile many formulas at the same time.

' RETURN message ) ELSE x = salary/contribution_proportion ‡ No Data Found: A database item supposed to be in the database was not found. For example. check for the divide by zero condition as follows: IF contribution_proportion = 0 THEN ( message = 'The contribution proportion is not valid..¶uninitialized¶ means you have not assigned any value to the variable before you try to use it. Oracle FastFormula passes a code back to the application indicating an error (the application then takes the appropriate action). This represents an error in the application data.. If this situation ever arises. In this formula. the formula: x = salary/contribution_proportion produces an error if the contribution proportion is set to zero. This causes an error in all statements except the Return statement.Always check for the possibility of a divide by zero error if there is any chance it could occur. . ‡ Too Many Rows: The database item definition within the application caused more than one value to be fetched from the database. This formula fails with an ¶Uninitialized variable¶ message (for the variable tax) if the tax band is set to 2000. ‡ Divide by Zero: Dividing a number by zero is an operation that provides no logical result. For example: IF (tax_band < tax =" salary"> 2000) THEN tax = salary / 10 IF tax > 1000 THEN.

‡ Invalid Number: This occurs only when a database item contains an item that does not make sense as a number. 39-DEC-1990. Navigate to the Formula window using your local Super HRMS Manager responsibility. ‡ Null Data Found: A database item was found to have a null value when it should have had a non-null value.‡ Value Exceeded Allowable Range: This can occur for a variety of reasons such as: ‡ exceeding the maximum allowable length of a string (which is 240 characters) ‡ rounding up a number to an excessive number of places. for example. How to write simple Fast Formulas in Oracle HRMS Assignment Write a formula to calculate the travel payment Pay Value by multiplying Distance by the company travel rate.100) ‡ using an invalid date. round (1. Write a formula to calculate the travel payment Pay Value by multiplying Distance by the company travel rate. for example. which is stored as a global value. Total Compensation > Basic > Write Formulas . Steps to write a Simple Formulas 1. Writing Simple Formulas Assume that a company has defined an element called µTravel Payment¶ with an input value called µDistance¶. How to define Global value has been already covered before. which is stored as a global value. Use the Default statement for database items marked as Default Required in the Database Items window. where xx is your group identifier. Name the formula XX_TRAVEL_PAYMENT.

5. 4. you would: . Select the Edit button. Write your formula in the Edit Formula window. Set your effective date to 1 January 2000. Save your work. where xx is your group identifier. Enter the name XX_TRAVEL_PAYMENT. When the formula verifies successfully. 7. Your formula should be similar to the followingDEFAULT FOR distance IS 0 INPUTS ARE distance travel_payment = distance * XX _TRAVEL_RATE RETURN travel_payment Note: To complete the setup for the travel payment. close the Edit Formula window. 8. 6. Select Oracle Payroll in the Type field. 3. then select the Verify button.2.

Update your Travel Payment formula to use the override travel rate. 7.‡ Define a formula processing rule to associate the formula with the Travel Payment element. and otherwise to use the global value. Your fast formula should be similar to the following: DEFAULT FOR distance IS 0 DEFAULT FOR override_travel_rate IS 0 INPUTS ARE distance. 1. Hint: Use the WAS DEFAULTED condition. 4. Writing Conditional Logic 1. Navigate to the Formula window using your local Super HRMS Manager responsibility. override_travel_rate IF override_travel_rate WAS DEFAULTED THEN travel_payment = distance * XX_COMPANY_TRAVEL_RATE ELSE . Save your work. Writing Conditional Logic in Fast Formulas Writing Conditional Logic Let us assume that the company has updated the Travel Payment element so that it now has a Pay Value and two input values: distance and override travel rate. 8. if it has been entered. Set your effective date to 1 January 2000. and verify it. When the formula verifies successfully. ‡ Define a formula result rule to return the travel_payment formula result to the element¶s Pay Value. Select the Edit button. 6. Query: XX_TRAVEL_PAYMENT. Total Compensation > Basic > Write Formulas 2. 3. Select Correction. close the Edit Formula window. 5. Most employees receive the travel rate stored in the global value. but there is the discretion to override it with a special rate using the override travel rate input value. where xx is your group identifier. Add the conditional logic to your formula.

Using the Round Function 1. Total Compensation > Basic > Write Formulas 2. override_travel_rate IF override_travel_rate WAS DEFAULTED THEN travel_payment = ROUND((distance * XX_COMPANY_TRAVEL_RATE). 3. Query XX_TRAVEL_PAYMENT.2) RETURN travel_payment . Select Correction.travel_payment = distance * override_travel_rate RETURN travel_payment How to add Functions to Fast Formulas Assignment Edit your Travel Payment formula to ensure that the result is always rounded to two decimal places. 8. and verify it. 7. When the formula verifies successfully. 5. Navigate to the Formula window using your local Super HRMS Manager responsibility.2) ELSE travel_payment = ROUND((distance * override_travel_rate). 6. where xx is your group identifier. Set your effective date to 1 January 2000. Select the Edit button. Your formula should be similar to the following: DEFAULT FOR distance IS 0 DEFAULT FOR override_travel_rate IS 0 INPUTS ARE distance. Using the Round Function Edit your Travel Payment formula to ensure that the result is always rounded to two decimal places. 4. close the Edit Formula window. Save your work. It can be done by using functions in Fast Formulas. Add the Round function to your formula.

Write your formula. where XX is your group identifier. For this you need to first write a validation formula and then select the formula in the Columns window and test it by entering values outside the valid range in the Table Values window. Set your effective date to 1 January 2000. (N) Total Compensation > Basic > Write Formulas 2. Select the Edit button. Save your work. 4. and test it by entering values outside the valid range in the Table Values window. Name the formula XX_CHECK_UNION_DUES. and verify it. 3. Enter XX_CHECK_UNION_DUES in the Name field. close the Edit Formula window. Formula Your formula should be similar to the following: INPUTS ARE entry_value(text) IF TO_NUM(entry_value) <> 50 THEN (formula_status = 'e' . Writing Formulas to Validate User Tables Write a validation formula that returns an error and a message if a user enters a value less than 10 or greater than 50 in the Dues column of your Union Dues user table. 5. 8. Select the formula in the Columns window. Navigate to the Formula window using your local Super HRMS Manager responsibility.Fast Formula to Validate User Tables in Oracle HRMS In this practice you will learn how to write a fast formula that validates the user table. Select User Table Validation in the Type field. 6. Writing Formulas to Validate User Tables 1. 7. When the formula verifies successfully.

19.formula_message = 'Union Dues must be between 10 and 50. Select the Columns button. In the Union A row of the Values region. 11. 24. Re-enter 32. Select Query By Example . 12. Re-enter 30 and tab to the next row. In the following tutorial you will learn how to define user tables and access table values in Fast Formulas. Enter 60 in the Value field and tab to the next field.Run from the View menu. Query: xx Union Dues. Navigate to the Table Values window using your local Super HRMS Manager responsibility. Select your validation formula in the Formula field. your error message should be displayed. where xx is your group identifier. enter 5 in the Value field. Select Correction. 23. 20. 25. Again. where xx is your group identifier.') ELSE formula_status = 's' RETURN formula_status. Select Correction. Set your effective date to 1 January 2000. Assignment . Oracle Fast Formula Tutorial-Defining User Tables and Accessing Table Values You should now be familiar with Oracle Fast Formulas. Navigate to the Table Structure window using your local Super HRMS Manager responsibility. 13. Query: xx Union Dues in the Name field. 22. Your error message should be displayed. 21. Save your work. Please re-enter. Set your effective date to 1 January 2000. (N) Other Definitions > Table Structure 10. Testing Your Validation Formula 15. Tab to the next field. 17. 18. Save your work. 14. formula_message Selecting the Validation Formula in the Columns Window 9. (N) Other Definitions > Table Values 16.

Create a user table called xx Union Dues (where xx is your group identifier).Create a user table called xx Union Dues (where xx is your group identifier). 11.Defining User Tables and Accesing Table Values Defining the Table Structure 1. 10. . 9. Select Match in the Match Type field. Save your work. Close the Column window. Union A 30 Union B 32 2. 1. ‡ (N) Other Definitions > Table Structure 2. 6. Navigate to the Table Structure window using your local Super HRMS Manager responsibility. Select the Columns button. where xx is your group identifier.Enter 30 and 32 as Value against column dues. using the input Union. Enter Dues in the Name field of the Columns window. 7. Save your work. Enter xx Union Dues in the Name field. Tasks to be carried out Defining User Tables and Accessing Table Values Imagine a company has defined a deduction for union dues. 5. using the following information. Select Number in the Key Units of Measure field. The deduction element has one input value (Union) for entering the name of the union to which the employee subscribes: Union A or Union B. Set your effective date to 1 January 2000. using the following information. 4. 8. Solution . using the input Union.Then write a formula called XX_UNION_DUES to get the appropriate deduction from the table. Enter Union in the Row Title field. 3. Row1-Union A 30 Row2-Union B 32 Then write a formula called XX_UNION_DUES to get the appropriate deduction from the table.

Save your work. Save your work. 28. Select the Edit button. Set your effective date to 1 January 2000. Set your effective date to 1 January 2000. Navigate to the Table Values window using your local Super HRMS Manager responsibility. 20. 13. ‡ (N) Other Definitions > Table Values 18. In the Values region. Query: xx Union Dues. you would: . 25. ‡ (N) Total Compensation > Basic > Write Formulas 24. Writing the Formula 23. 19. Enter 2 in the Sequence field and Union B in the Exact field of the next row. 27. 29. select Union A in the Exact field and enter 30 in the Value field. Enter the name XX_UNION_DUES. 22. 'dues'. Enter 1 in the Sequence field and Union A in the Exact field of the Rows window. 30. Select Oracle Payroll in the Type field. Navigate to the Formula window using your localSuper HRMS Manager responsibility.12. Formula Your formula should be similar to the following: DEFAULT FOR union IS ' ' INPUTS ARE union(text) deduction = 0 IF NOT union WAS DEFAULTED THEN deduction = TO_NUMBER(GET_TABLE_VALUE('xx_union_dues'. 26. Write your formula in the Edit Formula window. 15. Tab to the next row and select Union B in the Exact field and enter 32 in the Value field. where xx is your group identifier. When the formula verifies successfully. then select the Verify button. 21. Save your work. 16. close the Edit Formula window. Select New from the File menu. 14. Entering Table Values 17. where xx is your group identifier. Select the Rows button. union)) RETURN deduction Note: To complete the setup for the union dues deduction.

Save your work. Here in this example I will define a global value called XX_TRAVEL_RATE. 4. Select Number in the Type field. Enter the name XX _TRAVEL_RATE. 5. like µTravel reimbursement rate per mile¶ just for an easier identification.5. Navigate to the Globals window using your local Super HRMS Manager responsibility. 3. Set the effective date to 1 January 2000. where xx is your group identifier. Enter a description. The screenshot is itself self explanatory. 7. Total Compensation > Basic > Global Values 2. Enter a value for the amount of money paid per mile or kilometer for reimbursement of business travel expenses. Follow the simple steps for defining a Global Value 1. . where XX is your group identifier. such as 7. 6. Enter a value.‡ Define a formula processing rule to associate the formula with the Union Dues Deduction element ‡ Define a formula result rule to return the union_dues formula result to the element¶s Pay Value How to Define or Setup Global Value in HRMS To set-up the different rates for employee reimbursement options you define global value.

Sign up to vote on this title
UsefulNot useful