Chapter 25: Global Variables and Contexts in Fast Formulas
๐ Introduction
In Oracle Fusion Fast Formulas, global variables and contexts play a key role in dynamically retrieving system and user-specific data during formula evaluation. They allow formulas to access predefined values without manual input, making them highly adaptable for various HCM and payroll processing requirements.
๐ Global Variables
Global variables are predefined system variables provided by Oracle based on the type of formula being executed. These variables do not require declaration and are automatically made available in the formula context.
๐ Characteristics:
-
Read-only
-
Provided by Oracle
-
Automatically available
-
Formula-type dependent
๐ก Common Examples:
Variable Name | Description |
---|---|
ASSIGNMENT_ID | ID of the assignment being processed |
EFFECTIVE_DATE | The date for which the formula is executed |
PAYROLL_ID | Payroll ID assigned to the employee |
ELEMENT_NAME | Name of the element (if applicable) |
These variables simplify access to core information without extra setup.
๐งญ Contexts in Fast Formulas
Contexts are dynamic values that provide additional runtime data such as person, assignment, or legal entity. You can default them and access their values using CONTEXTS.<name>
syntax.
✅ How to Define and Use a Context:
This example defaults the context to a known value and retrieves the runtime value using the CONTEXTS
keyword.
๐ง Difference Between Global Variables and Contexts
Feature | Global Variables | Contexts |
---|---|---|
Declaration Needed | ❌ No | ✅ Yes (DEFAULT FOR ) |
Editable | ❌ Read-only | ✅ Custom defaults allowed |
Formula Type Dependent | ✅ Yes | ✅ Yes |
Use Case | System-provided values | Runtime data based on inputs |
๐งช Practical Example
Here’s a simple Fast Formula example that checks if an employee’s assignment ID is within a certain range:
๐ Summary
-
Global Variables are pre-populated and read-only.
-
Contexts allow for flexible data retrieval and need default values.
-
Both are essential for dynamic formula behavior.
-
Using contexts appropriately helps avoid hardcoding values and improves reusability.
✅ Chapter 25 Practice Quiz: Global Variables and Contexts
Question 1:
Which of the following statements about global variables is true?
A. They must be declared before use
B. They are editable during runtime
C. They are automatically provided by Oracle
D. They are used to store user passwords
๐ฉ Answer: C
Question 2:
What keyword is used to assign a default value to a context in Fast Formulas?
A. SET
B. INIT
C. DEFAULT FOR
D. CONTEXT ASSIGN
๐ฉ Answer: C
Question 3:
Fill in the blank:
Contexts are accessed in Fast Formulas using the prefix __________
.
๐ฉ Answer: CONTEXTS.
Question 4:
Which is not a correct use of a context variable?
A. DEFAULT FOR CONTEXTS.EFFECTIVE_DATE IS '2020/01/01'
B. MY_VAR = CONTEXTS.ASSIGNMENT_ID
C. DEFAULT CONTEXTS.PERSON_ID IS NULL
D. RETURN CONTEXTS.EFFECTIVE_DATE
๐ฉ Answer: C — because it misses the FOR
keyword.
Question 5 (True/False):
Global variables can be modified by the formula writer during execution.
๐ฉ Answer: False
No comments:
Post a Comment