Oracle Fast Formulas - Chapter 7: Understanding Inputs and Outputs in Fast Formulas

 Oracle Fast Formulas -  Chapter 7: Understanding Inputs and Outputs in Fast Formulas


Objective of This Chapter

This chapter explains how Inputs and Outputs work inside Oracle Fusion Fast Formulas, how to define them properly, and why they are critical for successful formula execution.


What are Inputs

  • Inputs are variables or values that your formula uses.

  • Inputs are passed to formulas from outside systems like Payroll, Benefits, or Absence modules.

  • Without inputs, a formula cannot calculate dynamic results.


How to Define Inputs

Inputs must be declared at the beginning of your formula using the INPUTS ARE keyword.

Example:

INPUTS ARE salary, bonus_percentage, joining_date

Here:

  • salary is a number input.

  • bonus_percentage is a number input.

  • joining_date is a date input.


Default Values for Inputs

Always set a default value for each input using the DEFAULT FOR keyword.

Example:

DEFAULT FOR salary IS 0 DEFAULT FOR bonus_percentage IS 0 DEFAULT FOR joining_date IS '1900/01/01'

This ensures your formula does not break when an input value is missing.


Types of Inputs

TypeExample
Numericsalary, overtime_hours
Textgrade_code, job_title
Datejoining_date, termination_date

What are Outputs

  • Outputs are final results that a formula gives back.

  • Outputs are passed back to the system that called the formula.

  • Example: Bonus amount, Eligibility status, Leave balance etc.


How to Define Outputs

You define outputs using the RETURN keyword.

Example:

RETURN bonus_amount

Here, bonus_amount will be sent back to Payroll or whichever process is calling the formula.

You can RETURN multiple values if your formula type allows it (like absence formulas).

Example for multiple returns:

RETURN absence_days, absence_hours

Rules for Inputs and Outputs

RuleReason
All inputs must have default valuesTo avoid NULL errors
Use meaningful names for inputsMakes formula easier to understand
Always RETURN at least one outputOtherwise formula execution fails
Match data type correctlyNumeric input should not be treated as text

Example Fast Formula

/* Bonus Calculation based on salary and performance */ INPUTS ARE salary, performance_rating DEFAULT FOR salary IS 0 DEFAULT FOR performance_rating IS 'AVERAGE' IF performance_rating = 'EXCELLENT' THEN bonus = salary * 0.20 ELSE bonus = salary * 0.10 RETURN bonus

Best Practices

  • Keep the number of inputs limited to only what is necessary.

  • Always document what each input and output is doing in the comments.

  • Validate input values inside the formula before using them.


Mini Practice Quiz

  1. What keyword is used to declare inputs in Fast Formulas?
    A INPUTS ARE
    B INPUT VARS
    C READS

Answer: A INPUTS ARE

  1. What happens if an input is missing and no default is set?
    A Formula succeeds
    B Formula fails
    C System uses previous value

Answer: B Formula fails

  1. How do you send the result back in a formula?
    A RETURN
    B SEND
    C OUTPUT

Answer: A RETURN

No comments:

Post a Comment