ff - fast formula in complete)
TRANSCRIPT
-
8/8/2019 FF - Fast Formula in Complete)
1/105
OracleFastFormulat
User s GuideRelease 11.0
Part N o. A5834601
Enabling the Information Aget
-
8/8/2019 FF - Fast Formula in Complete)
2/105
Oracle FastFormula User s Guid e, Release 11.0
Part N o. A5834601
Copyright E Oracle Corporation 1995
All rights reserved. Printed in the U.S.A.
Primar y Auth or: John Cafolla, Juliette Fleming an d Lou ise RaffoContribu tors: Mark Callaghan, Michael OShea
This so ftware w as not deve loped for use in any nuclear, aviation, mass
transit, medical, or other inherently dangerous appli cations. It is the
customers respons ibi lity to take all appropriate measures to ensure the safe
use of such applications if the programs are used f or such purposes.
This software/ documentation contains prop rietary information of Oracle
Corpor ation; it is prov ided u nd er a license agreemen t containing restrictions on
use and d isclosure and is also protected by copyright law. Reverse engineeringof the software is prohibited.
If this software/ documentation is delivered to a U.S. Governm ent Agency of
the Depa rtment of Defense, then it is delivered w ith Restricted Rights and th e
following legend is applicable:
Restricted Rights Legend Use, du plication, or disclosure by the Governmen t is
subject to restrictions as set forth in subparagraph (c)(1)(ii) of DFARS
252.2277013, Rights in Techn ical Data an d Compu ter Software (October 1988).
Oracle Corporation, 500 Oracle Parkway, Redwood City, CA 94065.
If this software/ documentation is d elivered to a U.S. Government Agency not
with in the Depa rtment of Defense, then it is delivered w ith Restricted Rights,
as defined in FAR 52.22714, Rights in Data General, including Alternate III
(June 1987).
The information in th is document is subject to change withou t notice. If you
find any p roblems in the d ocum entation, please report them to u s in writing.
Oracle Corporation does not w arrant th at this document is error free.
ORACLE, Oracle Alert, Oracle Financials, SQL*Plus are registered trademarks of Oracle
Corporation
Oracle Application Object Library, Oracle General Ledger, Oracle Human Resources,
Oracle Payroll, Oracle Report s, PL/ SQL, SQL*TextRetrieval are tradem arks of Oracle
Corporation.
All other produ cts or comp any n ames are u sed for identification p urp oses only,
and may be trad emarks of their respective own ers.
-
8/8/2019 FF - Fast Formula in Complete)
3/105
iContents
Contents
Preface Preface i. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
About This User s Guide ii. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Finding the Latest Information ii. . . . . . . . . . . . . . . . . . . . . . . . .
Assumptions iii. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Do N ot Use Database Tools to Modify Oracle App licationsData iv. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Other Information Sources v. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
About Oracle viii. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Thank You viii. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Chapter 1 Oracle FastFormula 1 1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Oracle FastFormula Overview 1 2. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Writing a Simple Payroll Calculation 1 2. . . . . . . . . . . . . . . . . . . .
Types of Input 1 3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Writing More Complex Calculations 1 5. . . . . . . . . . . . . . . . . . . .
Incorporating Conditions 1 6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Commenting your Formulas 1 8. . . . . . . . . . . . . . . . . . . . . . . . . . .
Formula Structure 1 9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Using the Formula Window 1 10. . . . . . . . . . . . . . . . . . . . . . . . . . .
Using the Globals Window 1 12. . . . . . . . . . . . . . . . . . . . . . . . . . . .
Defining Functions 1 13. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Using Oracle FastForm ula for Payroll Calculations 1 16. . . . . . . . . . .
Accessing Input Values in Payroll Formulas 1 17. . . . . . . . . . . . . .
Writing Efficient Payroll Calculation Formu las 1 19. . . . . . . . . . .
Writing Formulas for Element Skip Rules 1 21. . . . . . . . . . . . . . . .
-
8/8/2019 FF - Fast Formula in Complete)
4/105
ii Oracle Human Resources UK Users Guide
Using Oracle FastFormula for Validation 1 23. . . . . . . . . . . . . . . . . . . .
Examples 1 24. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Using Oracle FastFormula to Define QuickPain t Repor ts 1 26. . . . . .
Using Oracle FastForm ula to Defin e Assign ment Sets 1 28. . . . . . . . .
Oracle FastFormula Reference 1 29. . . . . . . . . . . . . . . . . . . . . . . . . . . . .Constants and Variables 1 30. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Constants 1 31. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Variables 1 32. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Expressions 1 35. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Arithmetic Operators 1 36. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Functions 1 36. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Text Functions 1 37. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Numeric Functions 1 39. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Date Functions 1 40. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Data Conversion Functions 1 41. . . . . . . . . . . . . . . . . . . . . . . . . . . .
GB Functions 1 44. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Comments 1 45. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Statements 1 45. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Alias Statement 1 45. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Default Statement 1 46. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Inputs Statement 1 46. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Assignment Statement 1 47. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
IF Statement 1 48. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Return Statement 1 50. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Compiling Formulas 1 50. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Formula Errors 1 51. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Appendix A Database Items A 1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Static Database Items A 2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Applicant Information A 2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Employee Assignment Information A 2. . . . . . . . . . . . . . . . . . . . .
Contact Addresses A 7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Contact Information A 8. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Employee Hire Information A 10. . . . . . . . . . . . . . . . . . . . . . . . . . . .
Location Details A 10. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Payroll Details A 12. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
People Addresses A 13. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
People Information A 15. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Recruiter Information A 17. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Supervisor Information A 18. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Date Information A 18. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
-
8/8/2019 FF - Fast Formula in Complete)
5/105
iiiContents
Dynamic Database Items A 19. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Element Database Items A 19. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Grade Rate Database Items A 22. . . . . . . . . . . . . . . . . . . . . . . . . . . .
Pay Scale Rate Database Items A 22. . . . . . . . . . . . . . . . . . . . . . . . .
Descriptive Flexfield Database Items A 23. . . . . . . . . . . . . . . . . . . .Key Flexfield Database Items A 25. . . . . . . . . . . . . . . . . . . . . . . . . .
Absence Database Items A 26. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Glossary
Index
-
8/8/2019 FF - Fast Formula in Complete)
6/105
iPreface
Preface
Welcome to Release 11.0 of the O racle FastForm ula User s Guide .
This guide includes the information you need to u nderstand and use
Oracle FastFormula. It provides details of syntax for each of the
statements an d fun ctions available in FastFormu la as well as examples
of the different types of formulas you m ay want to w rite.
This preface explains how the guide is organized and introd uces other
sources of information that can help you .
-
8/8/2019 FF - Fast Formula in Complete)
7/105
ii Oracle FastForm ula User s Gu id e
About This Users Guide
The main body of information you need to und erstand Oracle
FastFormula together w ith the reference information for each comm and
or function is contained in Chap ter 1.
The Database Item Ap pendix provid es a reference source that lists all
static and dyn amic database items that are available to you in
FastFormula. This list of items provid es a simp le method of accessing
your H RMS da ta in FastFormula.
This users guide is available online
All Oracle Applications users guides are available online, in bothHTML and Adobe Acrobat format. Most other Oracle Applications
docum entation is available in Ad obe Acrobat format.
The paper and online versions of this manu al have identical content,
and you can use whichever format is more convenient.
The HTML version of this book is optimized for onscreen read ing,
and lets you follow hyp ertext links for easy access to books across our
entire library. You can also search for w ords and ph rases if yournational langu age is sup ported by Oracles Information N avigator.
The HTML docum entation is available from th e Oracle Applications
toolbar, or from a URL provid ed by your system ad ministrator. Note
that the HTML documentation is translated into over tw enty
languages.
You can order an Oracle App lications Docum entation Library CD
containing Adobe Acrobat versions of each man ual in the Oracle
App lications docum entation set. Using this CD, you can search for
information, read it onscreen, and print individual p ages, sections, or
entire books. When you p rint from Ad obe Acrobat, the resulting
printouts look just like pages from an Oracle App lications hard copy
manual.
Finding the Latest Information
For information about any new features that w ere not available when
this user s guide w as printed , look at the Whats New ? section on the
main Help menu . This information is up da ted for each new release of
Oracle FastFormula H TML Help .
-
8/8/2019 FF - Fast Formula in Complete)
8/105
iiiPreface
Assumptions
This guid e assumes you hav e a working know ledge of the following:
the p rinciples and customary practices of your business area
the p laces where FastFormula are used in the Oracle HRMSprodu ct set.
If you are not familiar with Oracle HR or Oracle Payroll we
suggest you attend the introduction or implementation training
classes for these p rodu ct available through Oracle Edu cation.
the Oracle Applications grap hical user interface.
To learn more about th is, read th e Oracle Applications UsersGuide.
See Other Information Sources below for further details of Oracle
Applications product information.
-
8/8/2019 FF - Fast Formula in Complete)
9/105
iv Oracle FastForm ula User s Gu id e
Do Not Use Database Tools to Modify Oracle Applications Data
Oracle provides p owerfu l tools you can use to create, store, change,
retrieve and maintain information in an Oracle da tabase. But if you u se
Oracle tools like SQL*Plus to mod ify Oracle Applications data, you risk
destroying the integrity of your da ta and you lose the ability to aud itchanges to your data.
Because Oracle App lications tables are interrelated, any change you
make using an Oracle App lications form can up da te many tables at
once. But when you mod ify Oracle Applications data using anything
other than Oracle Applications forms, you may change a row in one
table without making correspond ing changes in related tables. If your
tables get out of synchronization w ith each other, you risk retrievingerroneous information an d you risk u npredictable results throughou t
Oracle Applications.
When you use Oracle Applications forms to mod ify your d ata, Oracle
App lications autom atically checks that your changes are valid. Oracle
App lications also keeps track of who changes information. But, if you
enter information into da tabase tables using d atabase tools, you m ay
store invalid information. You also lose the ability to track who has
changed your information because SQL*Plus and other d atabase toolsdo n ot keep a record of changes.
Consequently , w e STRONGLY RECOMMEND t hat you never use
SQL*Plus, Oracle Data Brow ser, database triggers, or any ot her tool t o
modify Oracle Applications t ables, unless w e tell y ou to do so in our
manuals.
-
8/8/2019 FF - Fast Formula in Complete)
10/105
vPreface
Other Information Sources
You can choose from m any sources of information, includ ing
docum entation, training, and support services, to increase your
knowledge and und erstanding of Oracle FastFormu la.
Most Oracle Applications documen tation is available in Ad obe Acrobat
format on the Oracle Applications Documentation Library CD. We supply
this CD with every software shipm ent.
If this guide refers you to other Oracle App lications documen tation,
use on ly the Release 11 versions of those books un less we specify
otherwise.
Oracle Applications Users Guide
This guid e explains how to navigate, enter data, query, run reports, and
introdu ces other basic features of the grap hical user interface (GUI)
available with th is release of Oracle App lications. It also includ es
information on setting user p rofiles, as well as runn ing and reviewing
reports and concurrent requests.
You can access this guide online by choosing Getting Started withOracle App lications from an y Oracle App lications help file.
Related Users Guides
Oracle FastFormula is integrated into the Oracle HRMS prod uct set.
Therefore, you m ay want to refer to other HRMS user s guides w hen
you u se Oracle FastFormula.
If you d o not have the hardcopy versions of these man uals, you can
read them by choosing Library from the Help menu , or by reading
from the Oracle App lications Docum ent Library CD, or by u sing a web
browser with a URL that your system ad ministrator provides.
Oracle Payroll Users Guide
This guid e is aimed a t Payroll man agers and explains how to set upand use Oracle Payroll to pay your emp loyees and meet necessary
legislative requirements.
Oracle Human Resources Users Guide
This guide is aimed at HR man agers and explains how to set up and
use Oracle Human Resources to meet the requirements of your
enterp rise. It describes how you can represent your enterpr ise
-
8/8/2019 FF - Fast Formula in Complete)
11/105
vi Oracle FastForm ula User s Gu id e
structures, policies, and p eople on the system and use this information
to manage your h um an resources.
Oracle HRMS Implementation Guide
This guid e includes mod ular imp lementation flowchar ts and checklists
to assist with your project plann ing. It contains a sum mary of the
sequence of recomm end ed steps for imp lementing Oracle FastFormula
and Oracle Payroll. Full instructions for each imp lementation step are
contained in the User s Guide.
Oracle Applications Flexfie lds Guide
This guide p rovides flexfields p lanning, setup , and reference
information for your imp lementation team , as well as for users
responsible for the on going maintenance of Oracle App lications
prod uct data. This guid e also provides information on creating custom
reports on flexfields data.
Oracle Applications User Interface Standards
This manu al contains the u ser interface (UI) stand ards followed by the
Oracle Applications developm ent staff. It describes the UI for the
Oracle App lications produ cts and how to app ly this UI to the design of
an app lication bu ilt by u sing Oracle Forms 4.5.
Installation and System Adminis tration
Oracle Applications Installation Manual
This man ual and the accomp anying release notes provide information
you need to successfully install Oracle Financials, Oracle Public Sector
Financials, Oracle Manufactur ing, or Oracle Hu man Resources in your
specific hard ware and opera ting system software environmen t.
Oracle Applications Upgrade Manual
This man ual explains how to prepare your Oracle Applications
prod ucts for an up grad e. It also contains information on finishing the
up grade procedure for each prod uct. Refer to this manu al and the
Oracle Applications Installation Manual when you p lan to up grade your
products.
-
8/8/2019 FF - Fast Formula in Complete)
12/105
viiPreface
Oracle Applications System Administrators Guide
This man ual provid es planning and reference information for the
Oracle Applications System Ad ministrator. It contains information on
how to define security, customize menu s and online help, and m anage
processing.
Oracle HRMS Technical Reference Manual
This man ual contains database diagram s and a d escription of Oracle
HRMS da tabase tables, forms, reports, and p rograms. This information
helps you convert data from your existing ap plications, integrate
Oracle HRMS with other nonOracle app lications, and write custom
reports.
You can ord er a technical reference manu al for any p rodu ct you have
licensed. Technical reference manu als are available in paper format
only.
Other Information
Training
Oracle Edu cation offers a comp lete set of training courses to help you
and your staff master Oracle App lications. We can help you d evelop a
training plan that provid es thorough training for both your project
team and your end users. We will work w ith you to organize courses
app ropriate to your job or area of responsibility.
Training professionals can show you how to p lan your tr ainingthroughout th e implementation process so that th e right amou nt of
information is delivered to key people wh en they need it the most. You
can attend courses at any one of our m any Edu cational Centers, or you
can arrange for our tra iners to teach at you r facility. In add ition, we
can tailor standard courses or develop custom courses to meet your
needs.
Support
From onsite support to central support, our team of experienced
professionals provides the help and information you need . This team
includes your Technical Representative, Account Manager, and Oracles
large staff of consultants and sup port specialists with expertise in your
business area, man aging an Oracleserver, and your hardw are and
software environment.
-
8/8/2019 FF - Fast Formula in Complete)
13/105
v iii O ra cle Fa stFor mu la User s Gu id e
About Oracle
Oracle develops and markets an integrated line of software products
for database management, applications development, decision support,
and office autom ation, as well as a complete family of financial,
manu facturing, and hum an resource applications.
Oracle produ cts are available for mainframes, minicompu ters, persona l
computers,network comp uters, and persona l digital assistants,
allowing organ izations to integrate d ifferent comp uters, d ifferent
operating system s, different netw orks, and even different da tabase
managem ent systems, into a single, un ified comp uting and information
resource.
Oracle offers its prod ucts, along w ith related consulting, education, andsup port services, in over 140 countries around the world. Oracle
Corporat ion is the world s leading sup plier of software for information
managem ent, and is the worlds second largest software compan y.
Thank You
Thank you for using Oracle FastFormula and this user s guide.
We value your comments and feedback. At the end of this manu al is a
Reader s Commen t Form you can use to explain what you like or
dislike about Payables or this user s guide. Mail your comm ents to the
following ad dress or call us d irectly at (650) 5067000.
Oracle Applications Documen tation Manager
Oracle Corporation
500 Oracle Parkway
Redw ood Shores, CA 94065
U.S.A.
Or, send electronic mail to [email protected].
-
8/8/2019 FF - Fast Formula in Complete)
14/105
C H A P T E R
1O
1 1Oracle FastFormu la
Oracle FastFormula
racle FastFormula is a simp le way to w rite formulas using English
words and basic math ematical fun ctions. You can use information
from you r d atabase in formu las without learning the database structure
or a programm ing langu age. The following topics explain how to wr ite
formulas using Oracle FastFormula:
Oracle FastFormula Overviewassumes no know ledge of formula
wr iting or ed iting. It progressively introdu ces the features of
Oracle FastFormula u sing examples.
Using Oracle FastFormula for Payroll Calculationsexplains some
add itional considerations for using formulas in the pay roll run .
Using Oracle FastFormula for Validation explains the required
format for formulas to check element entry valu es and u ser table
entry values.
Using Oracle FastFormula to Define QuickPaint Reports explains
how you can edit the formulas generated from your definitionsof QuickPaint rep orts.
Using Oracle FastFormula to Define Assignment Sets explains how
you can view and edit the formulas generated from your
definitions of assignment sets.
Oracle FastFormula Reference is a comp rehensive reference to all
the features of Oracle FastFormula and the ru les you mu st follow
in formula w riting.
-
8/8/2019 FF - Fast Formula in Complete)
15/105
1 2 O racle FastFormula User s Gu ide
Oracle FastFormula Overview
Formulas a re generic expressions of calculations or comparisons you
want to repeat with d ifferent inpu t values. They can take inpu t from
the wind ow, da tabase, or a process, such as a payroll run. They can
return values or messages.
You can use formulas to:
calculate element pay values and run results du ring payroll
processing
check that element entry values are valid for an assignmen t
check that en tries made to a user table are valid
specify the criteria for includ ing an assignment in an assignm ent
set
select the database information you w ant to d isplay in a
QuickPaint report, and perform calculations for the report
specify the rules for skipp ing an element d uring p ayroll
processing
prep are records in the format you require for the magnetic tapewr iter. For most coun tries, the Oracle localization team has
written the required formu las.
When you write a formu la, you specify for wh ich of these purp oses
you w ill use it.
In Oracle Payroll, the system generates m ost of the formulas need ed for
payroll processing, in response to your entry of information abou t your
earnings and dedu ctions. When necessary you can edit these
generated payroll formulas.
Formulas for QuickPaint reports and assignm ent sets can be generated
from criteria you enter in wind ows. You can edit these generated
formulas to add more functionality.
Writing a Simple Payroll CalculationThere are strict rules as to the word s and pu nctuation you mu st use in
a formu la so that Oracle FastFormula can correctly perform the
calculations and valida tion you require.
To start with a simp le examp le, sup pose you w anted to calculate the
pay va lue for the elemen t Wage by multiplying the nu mber of hours an
emp loyee works each w eek by his hourly rate. You could w rite this
formula:
-
8/8/2019 FF - Fast Formula in Complete)
16/105
Data Types
Using InputsStatement
1 3Oracle FastFormu la
wage = hours_worked * hourly_rate
RETURN wage
The first line is anAssignment statementthat simp ly assigns a value to
the elemen t Wage. The second line is aReturn statementthat passes
back the Wage value to the payroll run .
In this example, the Wage value is calculated , but it could be a constant
value, such as: wage = 200. To calculate th e Wage value, Oracle
FastFormula need s to get values for the variables hours_worked and
hou rly_rate. They are called v ariables because they can contain
different values dep end ing, in this example, on which assignment th e
payroll run is processing.
Both var iables and constants can be one of three data typ es:
numeric
text
date
The variables in th e Wage examp le are num eric.
Types of Input
We have said th at Oracle FastFormula need s to get values for the
variables hou rs_worked and hou rly_rate. There are three ways it can
get values:
it can receive them as inpu t when th e formula is called
it can find th e values in the d atabase from database items
it can u se global values, which you enter in the Globals window
To use a d atabase item or global value in your formu la, you simp ly
refer to it by nam e. You can brow se through lists of database items in
the Formu las window. To use a value passed to the formu la at run
time, you m ust w rite anInputs statement.
In our Wage examp le, supp ose that hours_worked is an inp ut v alue tothe element Wage. To pass the element inpu t values to the formula
du ring a payroll run, you define an Inpu ts statement, as follows:
INPUTS ARE hours_worked
wage = hours_worked * hourly_rate
RETURN wage
The name you u se in the Inpu ts statement mu st be the same as the
name of the element inp ut value, and mu ltiple words m ust be joined by
-
8/8/2019 FF - Fast Formula in Complete)
17/105
Using Database Items
Using Global Values
Using Local Variables
1 4 O racle FastFormula User s Gu ide
un derscores. In this example, the inpu t value hours_worked is
nu meric. If the inpu t value is not nu meric, you m ust tell Oracle
FastFormula whether it is text or date. For example:
INPUTS ARE start_date (date)
Sup pose that hou rly_rate is a standard ra te taken from the Grade Rates
table. This is an examp le of a database item. A database item has a
label, or special piece of code, telling Oracle FastForm ula th e path to
take to access the data. Oracle HRMS prod uces most of the database
items you need w ithout you taking any special action. These items
includ e both information uniqu e to your enterprise, which you hold in
flexfield segm ents, as well as stand ard information such as assignmen t
num bers and grades.
In the Formulas window, you p ick da tabase items from a list. You w ill
see that the name of the d atabase item for a grad e rate called
hou rly_rate is actually grad e_hou rly_rate_value. This is the name you
mu st use in your formu la.
By this nam ing convention, Oracle FastFormula knows that hou rly_rate
is a database item from the Grad e Rate table. But how d oes it know
which hourly_rate to use from th is table? It works this out from the
contextthe payroll run provid es for each elemen t entry. The context
identifies:
the Business Group
the elemen t and element link
the payroll and p ayroll run
the emp loyee and employee assignment.
Attention: You shou ld use an Inpu ts statement in preference
to d atabase items w here possible because th is is more efficient.
See: Writing Efficient Payroll Calculation Formu las: page 1 19.
Use global values to store information that d oes not change often, but
you refer to frequently, such as Comp any N ame, or compan ywide
percentages used to calculate certain types of bonu s. You d efine the
global value and change its value u sing the Globals wind ow.
See: Using the Globals Window : page 1 12
Local var iables exist in one form ula only. You can chan ge the valu e of a
local variable by assigning it a value in an Assignmen t statement. In
the Wage example, the variable wage itself is a local var iable. It
receives a value w ithin the formula by the Assignmen t statement:
wage = hours_worked * hourly_rate
-
8/8/2019 FF - Fast Formula in Complete)
18/105
Nested Expressions
1 5Oracle FastFormu la
Note: You cannot change the valu e of inpu t values, database
items, or global values within a formula.
Writing More Complex Calculations
The Assignmen t statement in the w ages examp le above uses a simple
mu ltiplication to calculate the value of the w ages element. You can a lso
use addition, subtr action, division, and a nu mber offunctions. For
example:
bonus = GREATEST(days_at_work,163) + bonus_rate
Here the function GREATEST tells Oracle FastFormula to u se the valu eof the variable d ays_at_work, if it is greater than 163, and otherw ise to
use th e constant 163.
The data type of variables and constants determines how op erators and
functions act on the values. For examp le, the ad dition opera tor (+) can
be used w ith num eric or text da ta, while division can be used with
nu meric data only.
There are special fun ctions th at convert variables from:
nu mbers to text (TO_TEXT)
dates to text (TO_TEXT)
text to date (TO_DATE)
text to nu mber (TO_NUM)
See: Functions: page 1 36
The Assignmen t statement can use as many arithm etic operators and
functions as you requ ire. Each function or calculation is one expression,
and you can nest expressions to create more comp lex calculations. You
mu st use brackets to make clear to Oracle FastFormula the order in
which the calculations are performed . For example:
ANNUAL_BONUS = trunc(((((salary_amount/100)*
bonus_percentage)/183)*(days_between(end_period_date,start_date) + 1)), 2)
Oracle FastFormula begins calculating inside the brackets and from left
to right, in the following steps:
1. salary_amount/100
2. 1.* bonus_percentage
3. 2. / 183
-
8/8/2019 FF - Fast Formula in Complete)
19/105
Using Simple
Conditions
Making Conditions
More Complex
WAS DEFAULTED
1 6 O racle FastFormula User s Gu ide
4. days_between (end_period_date, start_date)
5. 4. + 1
6. 3. * 5.
7. TRUNC(6.,2)
Notice that TRUNC is another function. It rounds a numeric value
dow n to the nu mber of decimal places specified after the comm a (two
in th is case).
Incorporating Conditions
In our simple Wage element example, only one value is returned , and it
is calculated in the same way for every assignment. How ever you may
need to p erform different calculations dep end ing on the particular
group of emp loyee assignmen ts, or the time of the year, or some other
factors. You can d o this by incorporating conditions in your formula.
For example:
IF age < 20 THENtraining_allowance = 30
ELSE
training_allowance = 0
The formula checks whether the condition (age < 20) is true or false. If
it is true, the formula p rocesses the statemen t that follows the word
THEN. If the condition is not true, the formu la ignores this statement
and processes any statem ent tha t follows the w ord ELSE. The ELSE
clause is optional.
In the examp le above, the cond ition comp ares a variable (age) to a
constant (20). The cond ition can be m ore comp lex, comp aring
expressions that contain fun ctions and a rithmetic operator s. For
example:
IF (DAYS_BETWEEN(end_period_date, start_date)+1) >= threshold
DAYS_BETWEEN is another function.
We have seen tw o comparators: less than (=). A full list of the comparators you can u se appears in the
Reference section.
See: Oracle FastFormu la Reference: page 1 29
There is a special type of cond ition called WAS DEFAULTED. Use th is
to test whether a d efault value has been placed in an inpu t value or
-
8/8/2019 FF - Fast Formula in Complete)
20/105
Combining Conditions
Incorporating Multiple
Actions based onConditions
1 7Oracle FastFormu la
da tabase item. Default values are placed using the Default statemen t.
For examp le:
DEFAULT FOR hourly_rate IS 3.00
X = hours_worked * hourly_rate
IF hourly_rate WAS DEFAULTED
THEN
MESG = Warning: hourly rate defaulted
In this example, if the d atabase item hourly_rate is empty (NULL), the
formula uses the defau lt value of 3.00 and issues a w arning m essage.
You can combine cond itions using the logical operators AN D, OR, NOT.
Use AND if you w ant an action to occur w hen m ore than one
condition is true. For example:
IF (days_between(end_period_date, start_date) + 1) >= 183
AND employee_status = FULL TIME
THEN . . .
Use OR if you w ant an action to occur w hen an y one of two or
more conditions is true. For example:
IF stock_level < 10000
OR order_size >= 1500
THEN . . .
Use NOT if you w ant an action to occur w hen a cond ition is not
true. For example:
IF NOT (months_between(purchase_date, system_date) => 60
THEN . . .
As with Assignment statemen ts, you m ay need to use brackets to tell
Oracle FastFormula in which order to test cond itions. By default, NOT
has the highest precedence, followed by AN D then OR. So the
following condition:
IF X = 6 AND NOT Y = 7 OR P >= 6
is interp reted as:
IF (X = 6 AND (NOT Y = 7)) OR P >= 6
How you u se brackets can change d ram atically the mean ing of a
formula.
Suggestion: Use brackets whenever you create mu ltiple
conditions, so that the m eaning of the formu la is clear to other
readers.
We have seen how to make conditions more complex. You can also
make the actions performed as comp lex as you like. In our simple
-
8/8/2019 FF - Fast Formula in Complete)
21/105
1 8 O racle FastFormula User s Gu ide
example above, the result of the condition was the assignment of a
value to the variable training_allowance. As well as assigning values,
you can perform calculations and return valu es.
For example, supp ose you m ust check wheth er there are sufficient
fund s in a bank accoun t before processing a withd raw al:
INPUTS ARE acct_balance,
acct (text),
debit_amt
IF acct_balance >= debit_amt
THEN
(
new_balance = acct_balance debit_amt
RETURN new_balance
)
ELSE
(
message = Account No. + acct + Insufficient Funds
message2 = Account Balance is + TO_TEXT(acct_balance)
RETURN message, message2
)
Notice that you can return tw o variables in the same Return statem ent.
Attention: The brackets following TH EN and ELSE are
essential wh en you have mu ltiple actions based on a condition.
Withou t them , Oracle FastFormula p rocesses the first statemen t
conditionally and the other statements u ncond itionally.
Commenting your Formulas
It is good p ractice to includ e comments in your formulas to explain to
other people what the formula does.
So, for example, you can name your formula:
/* Formula: Attendance Bonus */
and write an explanation of your formula:
/* Use this formula to calculate the annual bonus forclerical staff. Employees receive either a percentage of
their salary (if they have been present for 183 or more
days in the last six months), or a pro rata bonus (if they
have been in attendance for less than 183 days in the last
six months). */
Oracle FastFormu la ignores everything betw een the comment
delimiters: / * and */ . You can place commen ts anyw here in a formula
without affecting th e formulas performance.
-
8/8/2019 FF - Fast Formula in Complete)
22/105
Alias Statement
1 9Oracle FastFormu la
Warning: Do not put a comm ent within a comm ent. Thiscauses Oracle FastFormula to retu rn a syntax error.
You can use a comment to explain what part of your formula does. So,
for example, you might w ant a comm ent explaining w ho d ecides the
bonus percentage:
INPUTS ARE salary_amount,
start_date (date),
end_period_date (date),
bonus_percentage /* decided at board level */
You can also use commen ts to commen t out parts of the formu la you
do n ot currently wan t to use. So, for example, you can includ e a fifth
inpu t of emp loyee_status, ensuring tha t emp loyees with a status of full
time are award ed a bonus. How ever, as you d o not yet have a range ofstatuses, you d o not currently need the fifth inp ut.
INPUTS ARE salary_amount,
start_date (date),
end_period_date (date),
bonus_percentage /* decided at board level */
/* employee_status (text) */
Formula Structure
A valid formu la has a well defined structu re. It is mad e up of
commen ts and statem ents. Oracle FastFormula ignores commen ts and
carries out th e instructions in the statem ents.
We have already looked at four typ es of statement :
Assignment statement
Inputs statement
Return statement
If statemen t
There are two other types of statement you can u se:
Alias statemen t
Default statemen t
Database items are named by th e system w hen it creates them, and
sometimes these nam es are too long to conveniently use in a formu la.
You cannot shorten th e nam e of a database item (or a global value)
itself, but you can set up an a lternative shorter nam e to use within the
formula. For example:
-
8/8/2019 FF - Fast Formula in Complete)
23/105
Default Statement
Order of Statements
1 10 Oracle FastFormula Users Guide
ALIAS as_overtime_qualifying_length_of_service AS ot_qls
In the rest of the formu la, you can use the alias (in this examp le, ot_qls)
as if it were the actual variable.
Attention: Using an Alias is more efficient than assigning th eda tabase item to a local variable with a short nam e.
Use the Default statement to set a default value for an inpu t value or a
da tabase item. The formu la uses the default value if the da tabase item
is empty or no input value is provided w hen you run th e formu la. For
example:
DEFAULT FOR hourly_rate IS 3.00
X = hours_worked * hourly_rate
IF hourly_rate WAS DEFAULTED
THEN
MESG = Warning: hourly rate defaulted
This example sets a default of 3.00 for the d atabase item h ourly_rate. If
hou rly_rate is emp ty (NULL) in the d atabase, the formu la uses the
default value of 3.00. The formula uses the WAS DEFAULTED test to
detect wh en a default value is used , in w hich case it issues a w arning
message.
Attention: You m ust u se the Default statement for databaseitems that can be empty. The Database Items window includes
a check box labelled Default Requ ired. This check box is
checked for database items that can be emp ty. The Database
Items wind ow ap pears wh en you choose the Show Items
button on the Formulas window.
Statemen ts in your formu la must app ear in the following order:
1) ALIAS statem ents (if any)
2) DEFAULT FOR statements (if any)
3) INPUT statemen t (if any)
4) Other statem ents
Using the Formula Window
-
8/8/2019 FF - Fast Formula in Complete)
24/105
1 11Oracle FastFormu la
" To w rite or edit a formula:
1. Set your effective date to the date when you w ant to begin using
the formula.
2. To write a new formula, enter the formulas name and select a type.
To edit an existing formula, query its nam e.
3. Choose the Edit button to open a blank Edit Formula window
where you can write a new formula, or modify an existing one.
4. If you wan t to select database items, choose the Show Items button
to display the Database Items wind ow and run a qu ery. Copy and
paste items from this window to the Edit Formula w indow.
5. When you finish writing or editing the formu la, choose the Verify
button to compile it.
Thi id ifi i f l
-
8/8/2019 FF - Fast Formula in Complete)
25/105
1 12 Oracle FastFormula Users Guide
This process identifies any syntax errors in your formula.
6. When the formu la is verified successfully, save it.
7. Your next step depends on the type of formula:
If the formu la is of type Oracle Payroll, you m ust a ssociate itwith an element in the Formula Result Rules wind ow.
If the form ula is of typ e Element Skip, you select it in the Skip
Rule field of the Element window.
If the form ula is of type Element Inpu t Validation, you select it in
the Formula field of the Input Values window wh en you are
defining an element .
If the form ula is of type User Table Validation, you select it in theFormu la field of the Colum ns w indow wh en you are defining a
user table structure.
Test your formu la in the situation you intend to use it (such as, in a test
pay roll run) to ensure it contains no logical errors.
See Also
Defining an Elemen t (HR Users), Oracle Human Resources Users Guide
Defining an Element (Payroll Users), Oracle Payroll Users Guide
Defining an Elements Input Values, Oracle Human Resources Users
Guide
Setting Up User Tables, Oracle Human Resources Users Guide
Using the Globals Window
Use global values to store information that d oes not change often, but
you refer to frequently, as for examp le Compan y Name, or
companywide percentages used in th e calculation of certain bonu ses.You can use global values as var iables in formu las by simply referring
to the global value by nam e.
You can n ever change a global value using a formula. You change
global values in the Globals window. Global values are datetracked so
you can m ake da te effective changes ahead of time.
Global values are available to all formulas w ithin a Business Group .
-
8/8/2019 FF - Fast Formula in Complete)
26/105
1 13Oracle FastFormu la
" To def ine a global value:1. Set your effective date to the date when you w ant to begin using
the global value.
2. Enter a name, data type (num ber, text, or date), and value. You can
also enter a description.
Defining Functions
Many fun ctions are su pp lied with Oracle FastFormula. See: Functions:
page 1 36. In add ition, you can create other fun ctions as you requ ire
for use by Oracle FastFormula. Doing this involves two steps: creating
a new PL/ SQL fun ction, then registering it in the system u sing the
Define Function window.
You need to be aw are of two restrictions when creating user defined
functions. These are:
The current release of Oracle Payroll allows you to d efine
functions with IN typ e param eters only. This mean s that a user
defined function may only return one value. IN OUT and OUT
type param eters are not sup ported.
User defined functions shou ld not h ave any comm it, rollback, or
savepoint statemen ts as these could lead to data integrity
problems w ith the payroll run. In addition, they should not not
perform any d ata m anipulation as FastFormu la is intended as aread on ly tool.
Registering the Function
You register a new function by nam ing and defining it, then creating
contexts and p aram eters for it. Contexts are environment values that
do not get passed to the fun ction.
Where a fun ction requ ires a mixture of contexts (from th e
-
8/8/2019 FF - Fast Formula in Complete)
27/105
1 14 Oracle FastFormula Users Guide
Where a fun ction requ ires a mixture of contexts (from th e
FF_CONTEXTS table) and pa ram eters, the contexts shou ld be listed
first in the fun ction head er followed by the function param eters. Only
the function parameters, however, need to be used to call the function
from FastFormu la.
For example, a function requ ires eight values: three contexts and five
parameters. All eight values are listed in the function header bu t only
the five param eters are used to call the fun ction.
There are three classes of functions you can register:
external:These are fur ther PL/ SQL functions in add ition to the
ones already delivered with FastFormula. They do not take
contexts.
formula: These fun ctions are formulas called from other
formu las. This class of function is not supp orted in Release 11.
user defined: In practice, this is the on ly class of function you
need d efine. User defined fun ctions require both contexts and
parameters.
" To register a new function for Oracle FastFormula:
1. Enter a unique name for the new function.
2. Select date, num ber or text as its data type.
3. Select external or user defined as the class of the function.
4. Enter an alias for the function name if you require an alternative
nam e for it. You can also enter a description to explain w hat the
function is for. The Alias and Description fields are both optional.
5. Enter the definition of the function. Use the format: ..
6. Save your entries.
" To enter context usage and parameter information:
1. Choose the Context Usages button.
2. In the Context Usages window, select as many context items as yourequire for the function. The data typ e for each context displays
automatically.
Note: The functionality that calls FastFormula, that is, Qu ickPaint
or Payroll Processing, determines w hat contexts FastFormu la has
access to from the FF_CONTEXTS table.
3. Save your entries. The sequence number of each context is entered
automatically when you d o this.
4. Close the Context Usages window and choose the Parameters
-
8/8/2019 FF - Fast Formula in Complete)
28/105
1 15Oracle FastFormu la
4. Close the Context Usages window and choose the Parameters
button.
5. In the Parameters window, select the parameters, or operands, you
require to define the fun ction. Type and class display
automatically.
6. Check the Optional checkbox if you w ant the corresponding
param eter to be optional.
7. Check the Continuing checkbox if you want the function to make
more than one call to the param eter.
Note: You cannot define a parameter a s continu ing un less you also
make it optional. How ever, an optional param eter does not have to
be continu ing.
8. Save your entries.
Using Oracle FastFormula for Payroll Calculations
-
8/8/2019 FF - Fast Formula in Complete)
29/105
1 16 Oracle FastFormula Users Guide
Using Oracle FastFormula for Payroll Calculations
You u se Oracle FastFormula to d efine and mainta in the formu las you
need for pay and payrelated calculations.
You u se Oracle FastFormula:
wh en you w ant to edit the formulas the system generates for the
earnings types, other paym ents and d edu ctions you initiate in
Oracle Payroll. You make these edits d irectly to the generated
formula (not to a copy).
See: Using the Form ula Wind ow: page 1 10
if you d ecide to d efine an element for an earn ings or deduction
and write its formula you rself, instead of initiating the earnings
or ded uction. You w ould d o this only for an earnings or
ded uction with a highly comp lex calculation requiring a num ber
of different calls to the database.
When you receive Oracle Payroll, some formu las are predefined in
your system. You cannot m ake any changes to these formulas, but you
can copy them and mod ify the copies.
Additional Information: Refer to your Oracle Payroll manu al
for information about p redefined payroll formulas.
" To w rite formulas for elements you define:
1. Design your element and how it will be calculated.
2. Write any formulas required to validate input values (formula type
= Element Inp ut Validation).
3. Write a formu la, if required, to define the rules for skipp ing theelement d ur ing payroll processing (formula typ e = Element Skip).
4. Define the element, referencing any formu las written in steps 2
and 3
5. Write the formula or formulas for calculating the run results
(formu la type = Oracle Payroll).
6. Associate each Oracle Payroll type formu la with the element in the
Formula Result Rules wind ow, and specify wh at hap pens to theformula results for this element.
Note: You can associate several formu las with a single element,
each one for use w ith a different emp loyee assignment statu s. You
can also use the same formu la for more than one element . In this
case, if the formu la references pay or inpu t values (through the
Inputs statement), each element mu st have pay an d input values
with the same names.
See Also
-
8/8/2019 FF - Fast Formula in Complete)
30/105
1 17Oracle FastFormu la
Defining an Element (HR Users), Oracle Human Resources Users Guide
Defining an Element (Payroll Users), Oracle Payroll Users Guide
Accessing Input Values in Payroll Formulas
In many formulas for calculating pay, some or all of the information
you need comes from the input values of the element.
As a simp le examp le, sup pose you p ay some salaried em ployees using
a recurring element called Salary. The Salary element has an input
value called annu al_salary. You need a formu la that divides the inpu t
value into twelve parts:
INPUTS ARE annual_salary
Salary = annual_salary/12
RETURN Salary
Attention: When you u se an Inpu ts statement, you n eed to
make sure that n one of the inpu t values can h ave a value of
nu ll because this causes the formula to fail. You can avoid thisproblem by using the Default statement.
Using an Inputs statem ent is the most efficient way to access the inpu t
values of the element with w hich the formula is associated. However,
if the formu la uses the inpu t values of other elements, it mu st access
the da tabase items for them.
For examp le, if you w ant to use the inpu t value ann ual_salary in the
formula to calculate the element Bonus, you use the database item asfollows:
IF Salary_annual_salary > 20000
THEN
Bonus = bonus_rate * (sales_achieved sales_threshold)
Notice that the database item nam e is in two parts: the inpu t value
(annual_salary) name p refixed by the elemen t nam e (Salary). This is
the nam ing convention for the da tabase items of element inpu t values.
Multiple Entries of Element Input Values
When you define an element, you can enable multiple entries of the
element w ithin a payroll period.
As a simple example, supp ose you use the element Wages to pay some
weeklypaid em ployees. The Wages element has the inpu t value
hou rs_worked . Each week, you regularly make five entries for the
-
8/8/2019 FF - Fast Formula in Complete)
31/105
1 18 Oracle FastFormula Users Guide
input value hours_worked.
To calculate Wages, you can mu ltiply the hours worked each d ay by the
emp loyees standard rate from the grad e rates table, so that your
formula looks like this:
INPUTS ARE hours_worked
Wages = hours_worked * standard_rate
RETURN Wages
Dur ing the pay roll run, the formula fires five times, creating five
separate p ay values, one for each entry.
Now consider using the database item Wages_hou rs_worked instead of
an Inpu ts statemen t. The da tabase item for an entry value sums up all
the entries made in the payroll period .
This is a great convenience wh en referring to inpu t value totals for a
payroll period . However, you m ust be sure that it is the totals that you
want to use. In this example, using the database item produ ces the
wrong result.
Wages_hou rs_worked gives a single value that is the sum of the five
entries in each weekly payroll period . When the payroll run s, the
formula fires five times, each time calculating w ages using the total
hours worked in the week.
Attention: If mu ltiple entries are enabled for an element, becareful w hen u sing database items for the elements entry
values. These database items hold the sum of all the entries.
This includ es entries mad e as ind irect formula results du ring
the payroll run.
Database Items for Numeric Values Only
Entry value database items are not created for input values with u nits
of character, da te, or time w hen m ultiple entries are enabled for the
element. This is because entry values of these types cannot be sum med
over the payroll period. Only num eric values can be summ ed.
Nu meric inpu t values are those with un its of:
Hours
Integer
Money
Number
Notice that other d atabase items, such as default, minimu m, or
maximum , may be created for nonnum eric input values.
Writing Efficient Payroll Calculation Formulas
-
8/8/2019 FF - Fast Formula in Complete)
32/105
Formula Format
Variable Names and
Aliases
Input Statements
1 19Oracle FastFormu la
The following statemen ts are true as general gu idelines for typ ical
payroll runs:
The longer an elements formula, the longer its processing time.
The more elements entered for an assignm ent, the longer its
processing time.
One element associated w ith a lengthy formula usually processes
faster than two related elemen ts each associated w ith a short
formula.
The overall nu mber of elemen ts and form ulas in the system has
little effect on p rocessing efficiency. It is the n umber of elements
per assignment that affects processing time.
Use comm ents and w hite space freely when entering formulas. This
makes the formulas easier to read and und erstand , and has no effect on
performance or memory usage. Use ind entation for the same reason,
especially when you a re using brackets to control the order of
processing.
It is good p ractice to includ e the following information in a comment atthe beginning of a formula:
formula title and short statement of its pu rpose
description of formula inputs
list of variables and constants that may requ ire up da ting
description of the inpu t values of the elemen t that receives the
formulas direct result explanation of the formulas calculations
adm inistrative information such as the nam e, address and
telephone num ber of an office administering the earn ings,
ded uction, or charge the formu la affects
the d ates of formula m odifications, the nam es of those entering
the ed its, and possibly the reasons for change
Use names that are brief yet meaningful to improve read ability. Name
length has no effect on performance or mem ory usage. Use Aliases if
the names of database items or global values are long.
Use Inpu t statements rather than database items wh enever possible.
This improves formula p rocessing by as much as a factor of ten. It
speeds up th e runn ing of your p ayroll by elimina ting the need to access
the d atabase for the inpu t values.
Inefficient:
-
8/8/2019 FF - Fast Formula in Complete)
33/105
Date Literals
Single Expressions
Database Items
1 20 Oracle FastFormula Users Guide
Salary = Salary_annual_salary / 12
RETURN Salary
Efficient:
INPUTS ARE Annual_salary
Salary = Annual_salary / 12
RETURN Salary
Use the TO_DATE function only w hen th e operan d is a variable.
Inefficient:
Start_date = TO_DATE ( 12JAN1992 )
Efficient:
Start_date = 12JAN1992 (date)
Use a single expression in straightforward formulas w here this does
not lead to confusion.
Inefficient:
Temp = Salary / Annualizing_factor
Tax = Temp * 3
Efficient:
Tax = (Salary / Annualizing_factor) * 3
Do not refer to da tabase items un til you need th em. People sometimes
list at the top of a formula all the database items the formu la might
need , thinking th is helps Oracle FastFormula p rocess more qu ickly.
However, this in fact slows p rocessing by causing u nnecessary
da tabase calls.
Inefficient:
S = Salary
A = Age
IF S < 20000 THEN
IF A < 20 THEN
Training_allowance = 30
ELSE
Training_allowance = 0
Efficient:
IF Salary < 20000 THEN
IF Age < 20 THEN
Training_allowance = 30
ELSE
Training_allowance = 0
-
8/8/2019 FF - Fast Formula in Complete)
34/105
Balance D imensions
1 21Oracle FastFormu la
The first examp le always causes a database fetch for Age w hereas the
second only fetches Age if Salary is less than 20000.
Wherever p ossible, use balance dimensions for single assignm ents only
in formulas. Multiple assignm ents require more calculation, leading toslower processing time. The nu mber of genu ine mu ltiple assignmen ts
in a payroll is not norm ally high, and the presence of a small num ber
does n ot lead to any significant increase in overall p rocessing time.
There could be a p roblem, however, if you u nnecessarily link balance
dim ensions for mu ltiple assignments into general formulas.
Writing Formulas for Element Skip Rules
If your p ayroll policies require period ic or conditional p rocessing of an
element, you can write a formula to d efine when the run should
process the elemen t and w hen it shou ld skip it. For example, your
formula could sp ecify:
process the Union Fees element every three p eriods, or process the Union Fees elemen t every run u nless the
Union _Fees_Paid balan ce is greater than 10 000.
You can associate only on e element skip rule formu la with each
element. You must write and validate the formu la before you define
the element so tha t you can select the formu la from a list on the
Element wind ow.
" To w rite a formula defining a skip rule:
1. Select formula type Element Skip in the Formulas window.
2. Use as many input values as you require. The formula must set
and return a local variable of type text, and th is variable mu st be
called skip_flag.
If the retu rned value of this variable begins with the letter y (suchas Yes), all processing for the element is skipp ed. Oth erw ise the
element p rocesses as normal.
The following example of a skip ru le formula d efines that th e
Union Fees elemen t is not processed if the Union Fees Paid
-
8/8/2019 FF - Fast Formula in Complete)
35/105
1 22 Oracle FastFormula Users Guide
Union Fees elemen t is not processed if the Union_Fees_Paid
balance is greater than 10 000:
IF Union_Fees_Paid > 10000
THEN
skip_flag = yesELSE
skip_flag = no
RETURN skip_flag
Using Oracle FastFormula for Validation
-
8/8/2019 FF - Fast Formula in Complete)
36/105
1 23Oracle FastFormu la
You can use Oracle FastFormula to validate u ser entries into the
element inpu t values, and to user tables that you d efine. In both cases,
you m ust w rite and validate the formula before you d efine the element
or table, so that you can select the formula from a list in the Elemen twind ow or Columns window.
In the Formu las wind ow, select formu la type Element Inp ut Validation
or User Table Validation.
When w riting either type of formula, you m ust observe the following
rules:
There must be one inp ut value, of type text, and it m ust be called
entry_value.
The formula must set and return a local variable giving the
status of the validation (success or error). This variable mu st be
called formu la_status and have the value s (success) or e
(error).
Opt ionally, the formula can also return a text variable giving an
explanatory message. The return ed message variable mu st be
called formula_message and can contain any text. It can be
return ed w ith both successful and un successful statuses.
The formu la mu st not return any other results.
For an element inpu t value validation formula, you mu st also observe
the following rules:
You cannot use the elements other pay an d inp ut va lues in the
formula.
You cannot retu rn a value to another p ay or inpu t value.
All entry values are stored in the database as text items. Therefore, if
you w ant to validate an entry value as a d ate or num ber, you m ust use
Oracle FastFormulas conversion function to convert the text into a
da te or num ber type variable. For example:
TO_NUM (entry_value)
TO_DATE(entry_value,DDMONYYYY)
Examples
-
8/8/2019 FF - Fast Formula in Complete)
37/105
Checking an Element
Entry
1 24 Oracle FastFormula Users Guide
The formula below checks that th e entry value of the Salary element
does not exceed 200 000.
Classification TypePriority
Value Name Type Valid
Salary
Earnings R2500
Pay Value FMoney
Figure A 1Salary Element
/* Formula Name: Salary Range */
/* Formula Type: Element Input Validation */
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
Checking a User Table
Entry
The formula below checks that the ded uction entered in the Un ion A
column of the Union Du es table is betw een 10.00 and 20.00.
-
8/8/2019 FF - Fast Formula in Complete)
38/105
y
1 25Oracle FastFormu la
/* Formula Name: Union A Dues Validation */
/* Formula Type: User Table Validation */
INPUTS ARE entry_value (text)IF TO_NUMBER(entry_value) < 10.00 OR
TO_NUMBER(entry_value) > 20.00
THEN
(
formula_status = e
formula_message = Error: Union A dues must be between
$10.00 and $20.00.
)
ELSE
(
formula_status = s
formula_message =
)
RETURN formula_status, formula_message
See Also
Defining an Element (HR Users), Oracle Human Resources Users Guide
Defining an Element (Payroll Users), Oracle Payroll Users Guide
Defining an Elements Input Values, Oracle Human Resources Users
Guide
Setting Up User Tables, Oracle Human Resources Users Guide
Using Oracle FastFormula to Define QuickPaint Reports
I th D fi Q i kP i t R t i d t d t b it
-
8/8/2019 FF - Fast Formula in Complete)
39/105
1 26 Oracle FastFormula Users Guide
In the Define QuickPaint Report w indow, you can paste database items
from a list into the Report Definition area and enter free text to label the
da ta. When you save your Qu ickPaint Report definition, a formu la is
generated autom atically.
Formulas generated from QuickPaint do not include cond itional logic
or calculations. You m ay w ant to ad d th ese features, for example to
sum up compensation elements or to report different da ta for different
assignments.
Attention: If you w ant to add features to a generated
QuickPaint formu la, you m ust copy the formu la and ed it the
copy. If you ed it the original, your edits will be overwritten if
the formu la is regenerated from the Qu ickPaint definition.
Example
In this examp le, the generated Qu ickPaint formula has been ed ited to
add Line 09, which totals the inpu t values used in the report.
LINE01=
LINE02= Pay Items Value this Period
LINE03=
LINE04= Salary Value : + TO_TEXT(trunc((SALARY_ANNUAL/12),2))
LINE05= Item 1 Value : + TO_TEXT(ITEM_1_PAY_VALUE)
LINE06= Item 2 Value : + TO_TEXT(ITEM_2_PAY_VALUE)
LINE07= Bonus Value : + TO_TEXT(BONUS_AMOUNT)
LINE08= __________________
LINE09= Total : + TO_TEXT(trunc((
(SALARY_ANNUAL/12)+ITEM_1_PAY_VALUE+ITEM_2_PAY_VALUE+BONUS_AMOUNT)
,2))
LINE10=LINE11=
LINE12=
RETURN LINE01, LINE02, LINE03, LINE04, LINE05, LINE06, LINE07,
LINE08, LINE09, LINE10, LINE11, LINE12,
" To make a copy of a QuickPaint formula:
1. In the Formula window, query your QuickPaint formula. It has the
same nam e as your QuickPaint report.
2. Choose the Edit button. Select and copy the formula in the Edit
Formu la window.
3. Choose New Record from the Edit menu.
4. Enter a name for your edited copy and select the type QuickPaint.
5. Paste the text of the QuickPaint formu la into the Edit Formula
window.
6. Save your work.
-
8/8/2019 FF - Fast Formula in Complete)
40/105
1 27Oracle FastFormu la
See Also
Defining Qu ickPaint Reports, Oracle Human Resources Users Guide
Using Oracle FastFormula to D efine Assignment Sets
You d efine an assignm ent set in the Assignmen t Set wind ow You can
-
8/8/2019 FF - Fast Formula in Complete)
41/105
1 28 Oracle FastFormula Users Guide
You d efine an assignm ent set in the Assignmen t Set wind ow. You can
select da tabase items that you can use to define your set. When you
choose the generate bu tton in the Assignmen t Set wind ow, a formula is
generated from the criteria you entered.You shou ld not normally need to ed it assignment set formu las.
If you enter m ultiple criteria to d efine an assignm ent set, the conditions
that are generated a re joined by AN D or OR. You m ight want to edit
the formula to change the brackets in the generated cond itions. This
changes the order in w hich the cond itions are tested.
To view an assignment set formu la, query it in the Formu la wind ow.
The formu la type is Assignment Set and the formu la name is the sameas the assignm ent set name. To edit an assignm ent set formu la, make a
copy, as for a Q uickPaint formu la.
See Also
Creating an Assignm ent Set, Oracle Human Resources Users Guide
Oracle FastFormula Reference
Formulas comp rise statements an d comments Statemen ts are
-
8/8/2019 FF - Fast Formula in Complete)
42/105
1 29Oracle FastFormu la
Formulas comp rise statements an d comments. Statemen ts are
instructions telling Oracle FastFormu la how to p rocess constants an d
variables, which are the basic information un its in a formula. The two
key typ es of statement, w hich describe the formulas calculations, arethe Assignm ent statement and the If statement. These statements can
include expressions,wh ich manipu late constants and variables using
arithmetic operators an d functions. The operator s and fun ctions you can
use and th e results they give dep end u pon the d ata type of the
constants and variables. In If statements, one expression can be
comp ared to another using comparators to create a condition. Conditions
can be combined using logical operators.
An examp le of each of these formula comp onents is identified in th esamp le formula in Figure A 2. There are rules about how you u se
each of these components, and th ese rules are explained in this
reference section.
Figure A 2Components in a Sample Formula
-
8/8/2019 FF - Fast Formula in Complete)
43/105
1 30 Oracle FastFormula Users Guide
/* Formula: Attendance Bonus */
/* Use this formula to calculate the annual bonus for
clerical staff. Employees receive either a percentage
of their salary (if they have been present for 183 or
more days in the last six months, or a pro rata bonus
if they have been in attendance for less than 183
days in the last six months). */
INPUTS ARE salary_amount,
start_date (date),
end_period_date (date),
bonus_percentage /* decided at board level */
employee_status (text)
IF (days_between(end_period_date, start_date) + 1) >= 183
AND employee_status = FULL TIME
THEN
ANNUAL_BONUS =
trunc((( salary_amount/100 )* bonus_percentage ),2)
ELSE
ANNUAL_BONUS = trunc (((((salary_amount/100)*
bonus_percentage)/183)*(days_between(end_period_date,
start_date) + 1)), 2)
RETURN ANNUAL_BONUS
function
constant
variable
comment
expression
arithmetic
comparator
logical
Assignment
If statemen t
statement
Returnstatement
Inputsstatement
condition
operator
operator
Constants and Variables
Every piece of information that you can man ipu late or use in a formu la
is a constant or a variable.
The data typ e of a constant or variable describes wha t kind of data th e
constant or variable holds. Generally, you u se constant an d va riables
of the same data typ e in an expression.
Constants
Constants are actual values you use in a formu la. Oracle FastFormula
di l h h h ldi h i i bl
-
8/8/2019 FF - Fast Formula in Complete)
44/105
Numeric Constants
Text Constants
Date Constants
1 31Oracle FastFormu la
uses constants directly rather than holding th em in a variable.
There are three types of constant:
numeric
text
date
Enter nu meric constants without quotes. Precede negative nu mbers
with a minu s sign (). Num bers may have a decimal comp onent after a
decimal point. Do not use exponen ts and floating point (scientific)
notations. So, for examp le, you cannot use 22 or 10e1.24 as num eric
constants. Do not use comm as or spaces in a number. So, for example,
you cannot u se 10,000 or 10 000.00 nu meric constants.
Examples of valid nu meric constants are:
63
3.55
2.3
0.33
.2
10000
Enclose text constants in single quotes. They may conta in spaces. You
can represent the single quote character in a text constant by w riting it
twice (). Note th at this is not the same as th e dou ble quote ().
Examples of valid text constants are:
J. Smith
P ODon nell
1234
Manager
12 Glebe Lane
The Bonus this year is 23%Date constants contain a d ate. Enclose dates in single quotes and
follow immediately with the word d ate, in brackets. Use the format
DDMONYYYY.
Examples of valid da te constants are:
12MAR1989 (DATE)
4FEB1989 (date)
Variables
You use variables in a form ula to access information. Variables can have
f tl h i l
-
8/8/2019 FF - Fast Formula in Complete)
45/105
Local Variables
Global Values
1 32 Oracle FastFormula Users Guide
frequently changing values.
The data typ e of a variable determines the typ e of information the
variable holds: numeric
text
date
You d o not have to tell Oracle FastFormula w hat typ e you w ant a
variable to be. It works this out by seeing how you use the variable.
For examp le, if you set a var iable to J. Smith, Oracle FastFormula
know s it is a text variable.
Oracle FastFormula also warn s you if you try to p erform any
inconsistent operations, such as trying to add a nu mber to a text string.
There are three classes of var iable in Oracle FastForm ula:
Variables that occur in a single formu la only.
Values that can occur in any formula.
Items that exist in the app lications database.
The variable class determines how a formula uses it.
Local variables occur in a single form ula on ly. You can chan ge a local
variable within the formu la by assigning a value to it using an
Assignment statement.
You can u se local variables to store data in a formu la. You m ight want
to hold data temp orarily while you perform some other calculations, orto pass da ta back to the app lication.
Below is an example showing the u se of a local variable, annual_leave.
/* Formula: Annual Leave Formula */
IF years_service >= 10
THEN
annual_leave = 25
ELSE
annual_leave = 20 + FLOOR (years_service/2)
RETURN annual_leave
Global values are visible from w ithin any formu la. Use global values to
store information th at does not change often, but you refer to
frequently, such as compan y nam e, or a location allowance that applies
to many em ployees. Global values are datetracked so you can make
da te effective changes ah ead of time.
Local Variable
Global Value
Database Item
You can n ever change a global value using a formula. You alter global
values using the Globals window. The global value is the same across
all formu las within a Business Group .
-
8/8/2019 FF - Fast Formula in Complete)
46/105
Database Items
1 33Oracle FastFormu la
See: Using the Globals Window : page 1 12
Below is an example using a global value.
/* Formula: HAZARD ALLOWANCE FORMULA */
IF basic_hours > hazard_limit
THEN
hazard_allowance = 2.30
ELSE
hazard_allowance = 2.00
RETURN hazard_allowance
In this example, hazard _limit is a global value, which has been preset toreflect the point at wh ich w orkers hazard paym ent increases.
Database items exist in the app lication database and h ave a label, hidden
from users, that the system uses to find the data.
There are two types of database item:
Static da tabase items are pred efined . They includ e stand ard
types of information, such as the sex, birth d ate, and w orklocation of an em ployee, or the start and end dates of a pay roll
period.
Dynamic da tabase items are generated from your definitions of:
elemen ts
balances
absence types
grade rates and pay scale rates
flexfield segments
The name of your element, pay and inp ut va lues, balance, absence
type, grad e rate, pay scale rate, or flexfield segmen t becomes part of
the nam e of the generated d atabase item. This helps you identify the
da tabase item you need when you display a list of all available items in
the Formulas window.
Definitions of flexfield segments only become d atabase items w hen you
initiate the Declare Descriptive Flexfield process from the Submit
Requests window. The other definitions become database items
immed iately when you save them to the database.
See:
Static Database Items: page 2
Dynam ic Database Items: page 29.
Database items are specific to the contextin which you use them. For
example using the database item hourly rate gives the app ropriate
-
8/8/2019 FF - Fast Formula in Complete)
47/105
Rules for Determining
Variable Class and
Data Type
Naming Variables
1 34 Oracle FastFormula Users Guide
example, using the database item hourly_rate gives the app ropriate
hou rly rate for the specific assignment being processed.
Like global values, database item va lues cannot be changed within aformula.
The rules that determ ine 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)
If you do not specify the variable type in th e statement, Oracle
FastFormu la assumes it is num eric.
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 var iable is
in the list, Oracle FastFormula d etermines the d ata typ e from th ere.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 FastFormu la
knows the data type.
4. Finally, if Oracle FastFormula d oes not find the variable in either
the global values or the d atabase items, then it treats the variable as
a local variable. It determ ines the da ta type from the w ay you use
the variable.Notice that if the variable is either a global value or a d atabase item,
then any attemp t in your formula to alter the value of the variable
causes an error.
If the var iable is a local variable, it d oes not contain a va lue w hen it is
first used in the formu la. Therefore you mu st 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 wh en you attemp t to verifyor run the formu la.
Suggestion: To avoid a failure, assign values to your localvariables when they first appear in your formula.
Variables have nam es compr ising one or more word s. The words mu st
be joined by underscores. The words must each start with an
alphabetic character (AZ) and can be followed by a lphan um eric
characters (AZ, 09). The maxim um size of a variable name is 80
characters.
Oracle FastFormu la is not sensitive to case. So, for examp le, the
-
8/8/2019 FF - Fast Formula in Complete)
48/105
1 35Oracle FastFormu la
p
var iable called EMPLOYEE_NAME is the sam e as the var iable
Employee_name.
There are a nu mber of word s you cannot u se as the names of variables.
These reserved words are:
ALIAS AND ARE AS
DEFAULT DEFAULTED ELSE EXECUTE
FOR IF INPUTS IS
NOT OR RETURN THEN
USING WAS
Any w ord consisting only of digits (that is, that could be treated asa number)
You m ay find tha t the name of a database item or global value is too
long to use conveniently in your formula. You can set up an
alternative, shorter name for use within a formula. You set this up
using the Alias statemen t.
See: Statem ents: page 1 45
Expressions
Expressions combine constants and variables with arithm etic operators
(+, , *, / ) and functions to return a value of a certain da ta type. For
example, the expression (3 + 2) return s a value of 5, and is of
num eric data type.
The format of an expression is:
SUBEXPRESSION [operator SUBEXPRESSION ...]
This means tha t a num ber of subexpressions can combine in a single
expression. For examp le, the subexpressions (3 + 2) an dMONTHS_BETWEEN(start_date, end_date) can combine in a
single expression as follows:
(3 + 2) + MONTHS_BETWEEN(start_date, end_date)
Expressions can also be used inside functions, as in th e following
example:
salary = GREATEST(minimum_wage, (hourly_rate * hours_worked))
Data Type of
Expressions
The rules for determ ining the data type of an expression are simple.
Operand s in an expression are normally of the same data typ e, and this
is normally the data type of the expression as a whole. For examp le, in
the following expression all the operan ds are numeric and the
-
8/8/2019 FF - Fast Formula in Complete)
49/105
1 36 Oracle FastFormula Users Guide
the following expression all the operan ds are numeric and the
expression itself is numeric:
GREATEST(minimum_wage, (hourly_rate * hours_worked))
There are some exceptions to this. For examp le:
DAYS_BETWEEN(date1, date2)
MONTHS_BETWEEN(date1, date2)
These have d ate operands, but return a nu meric value.
So the expression:
4 + days_between(start_date, todays_date)
return s a nu meric result.
Arithmetic Operators
An expression may contain arithmetic operators, wh ich determ ine how
variables and constants are manipu lated. For example, the operator
+ indicates that two items shou ld be ad ded together.
The division, subtraction, and mu ltiplication op erators can only beused w ith num eric operand s. The operand s can be variables,
constants, or subexpressions. A formu la error occurs if:
the result of subtraction is too large a negative num ber
the result of m ultiplication is too large
the second operan d of a division evaluates to zero
In both cases, too large here is determ ined by the n ormal limits in the
ORACLE database.
The addition operator can be used w ith num eric or text operand s. If
the resu lt is greater than 240 characters, a formu la error occurs.
Notice that you enclose text constants in single forward quotes on ly (),
not double quotes (). For example, the statements:
string1 = will
result_string = Pigs + string1 + fly
set the local variable result_string to Pigs w ill fly.
Functions
Oracle FastFormula provides fun ctions that manipu late data in
different ways. Some functions work on only one type of data, some
can work on two, others work on all three data types.
The fun ctions are described below, separated into the three d ata typ es
and fun ctions that convert between data types. Where a function
return s a different da ta type result than the data typ e of its operan ds,
the d escription explains this.
-
8/8/2019 FF - Fast Formula in Complete)
50/105
GET_LOOKUP_
MEANING
GET_TABLE_VALUE
GREATEST
1 37Oracle FastFormu la
the d escription explains this.
The general form of a function is:
NAME OF FUNCTION(operand, operand, . .)
Notice that, as with the operator s, the operand s of a function can be
variables, constants, or comp lete expressions. If the op erand is a text
string, you mu st enclose it in quote m arks.
Text Functions
GET_LOOKUP_MEANING(lookup_type , lookup_code)
The GET_LOOKUP_MEANING function enables Oracle FastFormula
to translate a lookup code into a meaning. This can be used for any
descriptive flexfield items or d eveloper flexfield items tha t are based on
lookups.
Example
GET_LOOKUP_MEANING (ETH_TYPE, PEOPLE_GB_ETHNIC_ORIGIN)
GET_TABLE_VALUE(table_name, column_name, row_value [,effective
date])
The GET_TABLE_VALUE function retu rns the valu e of a cell in a
userdefined table. The three text operan ds, wh ich iden tify the cell
(table_name, column_name, and row _value), are mand atory. The dateoperan d is optional. If it is not supplied, the function returns the cell
valu e as of the effective date.
You cann ot use th is fun ction in formu las for u ser table validation or
QuickPaint reports.
Example:
GET_TABLE_VALUE(WAGE RATES, Wage Rate, Rate_Code)
GREATEST(expr, expr[, expr] . . .)
GREATEST_OF(expr, expr[, expr] . . .)
The GREATEST function compares the values of all the text string
operan ds. It return s the value of the operand tha t is alph abetically last.
If there are tw o or more op erand s that m eet the criteria, Oracle
FastFormu la returns the first.
LEAST LEAST(expr, expr[, expr] . . .)
LEAST_OF(expr, expr[, expr] . . .)
The LEAST function comp ares the va lues of all the text string
-
8/8/2019 FF - Fast Formula in Complete)
51/105
LENGTH
SUBSTRING
UPPER
1 38 Oracle FastFormula Users Guide
p g
operan ds. It return s the value of the operand that is alph abetically
first. If there are two or m ore operand s that meet the criteria, Oracle
FastFormu la returns the first.
LENGTH(expr)
The LENGTH function retu rns the num ber of characters in the text
string operand expr.
Note: The data typ e of the result of this fun c