Data Types for Constants and Variables in Oracle HRMS Fast Formula

By | December 1, 2014


There are three types of constants that can be used in fast formula
• numeric
• text
• date

Numeric Constants

Do not use commas or spaces in a number. So, for example, you cannot use 10,000 or 10 000.00 numeric constants.

Examples of valid numeric constants are:
• 83
• 6.55
• -7.3
• – 0.23
• – .26
• 15000

Text Constants

Text constants are enclosed in single quotes. They may contain spaces. You can represent the single quote character in a text constant by writing it twice (”). Note that this is not the same as the double quote (“).

Examples of valid text constants are:
• `F. Ashraf’
• `P O”Donnell’
• `1234′
• `Manager’
• `12 Union Road’
• `The Bonus this year is 23%’

Date Constants

Date constants contain a date. Enclose dates in single quotes and follow immediately with the word date, in brackets. Use the format YYYY-MON-DD HH24:MI:SS or
DD-MON-YYYY. It is recommended that you use the first format if you want to compile the formula under different language settings.

Examples of valid date constants are:
• `1989-03-12 00:00:00′ (date)
• `12-MAR-1989′ (date)


The data type of a variable determines the type of information the variable holds. Following three data types can be used as variables.
• numeric
• text
• date

You do not have to specify what type you want a variable to be. Oracle Fast Formula works out the type from how you use the variable. For example, if you set a variable to `F. Ashraf’, this is interpreted as a text variable. The system also warns you if you try to perform any inconsistent operations, such as trying to add a number to a text string. If you do not specify the variable type in the statement, Oracle FastFormula assumes it is numeric.

There are three classes of variable in Oracle FastFormula:
Local Variable – Variables that occur in a single formula only.
Global Value – Values that can occur in any formula.
Database Item – Items that exist in the application’s database.
The variable class determines how a formula uses it.

Local Variables

These variables exist within a single formula only. value of a local variable can be changed within the formula by assigning a value to it using an Assignment statement.
You can use local variables to store data in a formula. You might want to hold data temporarily while you perform some other calculations, or to pass data back to the

Below is an example showing the use of a local variable, annual_leave.
/* Formula: Annual Leave Formula */
IF years_service >= 10
annual_leave = 25
annual_leave = 20 + FLOOR (years_service/2)
RETURN annual_leave

Global Values

Global values are datetracked. Global values are defined and altered through Globals window. These values are visible from within any formula. Use global values to store information that does not change often, but you refer to frequently, such as company name, or a location allowance that applies to many employees.
You can never change a global value using a formula.

Below is an example using a global value.
IF basic_hours > hazard_limit
hazard_allowance = 2.30
hazard_allowance = 2.00
RETURN hazard_allowance
In this example, hazard_limit is a global value, which has been preset to reflect the point
at which workers’ hazard payment increases.

Database Items

Database items exist in the application database and have associated code that the system uses to find the data. All database items are read-only variables. An attempt to write to a database item causes a compiler error. Database item values cannot be changed within a formula. Database items exist in the application database and have a label, hidden from users, which the system uses to find the data. Database items are specific to the context in which you use them.

There are two types of database items:
• Static
• Dynamic

Static Database Items

Static database items are predefined. They include standard types of information, such as the sex, birth date, and work location of an employee, or the start and end dates of a payroll period.

Dynamic Database Items

Dynamic database items are generated from your definitions of:
• elements
• balances
• absence types
• grade rates and pay scale rates
• flexfield segments

The name of your element, pay and input values, balance, absence type, grade rate, pay scale rate, or flexfield segment becomes part of the name of the generated database item. This helps you identify the database item you need when you display a list of all available items in the Formulas window. Definitions of flexfield segments only become database items when you initiate the Declare Descriptive Flexfield process from the Submit Requests window. The other definitions become database items immediately when you save them to the database. Like global values, database item values cannot be changed within a formula.

Important Note for Database Items

Entry value database items are not created for input values with units of character, date, or time when multiple entries are enabled for the element. This is because entry values of these types cannot be summed over the payroll period. Only numeric values can be summed. Numeric input values are those with units of:
• Hours
• Integer
• Money
• Number
Notice that other database items, such as default, minimum, or maximum, may be created for non-numeric input values.

How Fast Formula Evaluates a Variable Class and its Data Types

Variable Class in Fast Formula

Order of Evaluation for Variable Class in Fast Formula

The rules that determine the data type and class of variables in a formula are:

1. The variable can be an input you name in the Inputs statement. For example: INPUTS ARE salary_amount,start_date (date),frequency (text)

2. If the variable is not an input, Oracle FastFormula looks in the list of global values the first time the variable occurs. If the variable is in the list, Oracle FastFormula
determines the data type from there.

3. If the variable is not in the list, Oracle FastFormula searches the list of database items. Again, if it is in the list, Oracle FastFormula knows the data type.

4. Finally, if Oracle FastFormula does not find the variable in either the global values or the database items, then it treats the variable as a local variable. It determines the data type from the way you use the variable.

Notice that if the variable is either a global value or a database item, then any attempt in your formula to alter the value of the variable causes an error. If the variable is a local variable, it does not contain a value when it is first used in the formula. Therefore you must assign a value to the variable before you try to use it in a condition or expression. If you fail to assign a value, Oracle FastFormula fails when you attempt to verify or run the formula.

Tip: To avoid a failure, assign values to your local variables when they first appear in your formula.