You are on page 1of 35

Time and Labor Fast Formula Reference Guide

OR AC LE WHI TE P AP E R | M ARCH 2015


Disclaimer
The following is intended to outline our general product direction. It is intended for information
purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any
material, code, or functionality, and should not be relied upon in making purchasing decisions. The
development, release, and timing of any features or functionality described for Oracle’s products
remains at the sole discretion of Oracle.

TIME AND LABOR FAST FORMULA REFERENCE GUIDE


Table of Contents

Disclaimer 1

Oracle Fusion Time and Labor Fast Formula Introduction 3

Rule Templates, Rules, and Rule Sets 4

Workforce Management Formulas 4

Rule Template 4

Rules 6

Rule Sets 6

Workforce Management Time Entry Rules 7

Contexts 7

Database Items 7

Input Variables 7

Formula: WFM_PERIOD_MAXIMUM_TIME_ENTRY_RULE 7

Fixed Parameters 11

Valid Functions 11

Return Variables 11

Formula: WFM_PERIOD_MINIMUM_TIME_ENTRY_RULE 12

Fixed Parameters 16

Valid Functions 16

Return Variables 16

Workforce Management Time Calculation Rules 17

Contexts 17

Database Items 17

TIME AND LABOR FAST FORMULA REFERENCE GUIDE


Input Variables 17

Formula: WFM_THRESHOLD_TIME_CALCULATION_RULE 17

Fixed Parameters 22

Valid Functions 22

Return Variables 22

Appendix 24

Appendix 1: Formula Types 24

Appendix 2: Contexts 26

Appendix 3: Workforce Management Functions 27

Appendix 3.1: Working Storage Area Functions 27

Appendix 3.2: Rule Parameter and Header Values Functions 28

Appendix 4.3: Miscellanies Functions 28

Appendix 5: Database Items 30

Appendix 6: Input Attributes 31

2 | TIME AND LABOR FAST FORMULA REFERENCE GUIDE


Oracle Fusion Time and Labor Fast Formula Introduction
Oracle Fusion Fast Formula is an easy way to customize the existing functionality in Oracle Fusion
Time and Labor. Formulas are pieces of code that can receive information from calling program
(packages), access database information, and return values to the calling program. The calling
program can use this information to modify the process functionality. The fast formula language hides
the complexity of accessing the tables and column.

A formula can return more than one value to the calling program. Different programs that call the
formula expect outputs to be returned differently. Based on the formula type, the number and data type
of values to be returned are predefined.

» Some programs expect the predefined names for output variables: the location of a variable in the
return statement does not matter.
» Some programs expect the return variable to be returned by location; in this case the name of output
variables does not matter.
» If predefined names are expected to be used and the formula does not use the expected names, the
process would error out at run time.

3 | TIME AND LABOR FAST FORMULA REFERENCE GUIDE


Rule Templates, Rules, and Rule Sets
Time and Labor uses a rule template to associate input values, parameters, and output values with a fast formula
while processing time rules. The formula and template enable the return of as many data types as required. Each
data type is associated with time attributes in the template.

As shown in the following figure, formulas are associated with rule templates which are used to create rules. A group
of rules form a rule set. Rule sets are attached to a person’s core processing profile.

Workforce Management Formulas


Workforce Management encompasses the architecture, core components, and applications to manage workers'
time-related information. It also encompasses both the Oracle Fusion Time and Labor and Oracle Fusion Absence
Management applications and other shared components. Formulas for Time and Labor rules are delivered with the
WFM designation in the name, representing Workforce Management.

Rule Template
A rule template is an interface that exposes input values, parameters, and output variables from the associated fast
formula. The purpose of rule templates is to simplify rule configuration. Administrators determine exactly which
parameters the formula requires and the value that the formula returns. They document this information in the
template.

4 | TIME AND LABOR FAST FORMULA REFERENCE GUIDE


When administrators create a rule, they pick the template to use rather than the formula. The template automatically
populates the description of all outputs and provides a mechanism that helps administrators enter the parameters.

As shown in the following figure, you can create a time entry validation rule template with Defined_Limit (the
maximum number of work hours) as a parameter.

5 | TIME AND LABOR FAST FORMULA REFERENCE GUIDE


The rule template ensures that the parameters are of the correct data type. The same logic applies to template
outputs. The rule template can ensure that the output uses only specific time attributes, and the correct number of
outputs are associated with the formula results.

Note: Multiple rules can share the same template with different parameter values. For example, two rules created
using the preceding example rule template could have the defined limit values of 36 and 40 hours, respectively.

Rules
Time and Labor administrators use the two delivered rule template types to create two types of rules:

» Time entry rules validate time card entries and can generate a message with a defined severity.
Example: Workers cannot enter more than a specified number of hours per week.

» Time calculation rules use entered values to either update the entries or create additional entries depending on
the formula logic.
Example: US states do not all calculate overtime the same. Configure and assign different time calculation rules
based on the primary work location of US workers.

Rule Sets
Rule sets are a date-effective collection of rules or rule sets of the same type. Effective dates enable you to add,
delete, and edit rules and embedded rule sets within the rule set. Assign rule sets to groups of workers with similar
vacation and time processing requirements using a time processing profile.

6 | TIME AND LABOR FAST FORMULA REFERENCE GUIDE


Workforce Management Time Entry Rules
Time entry rules (TER) use fast formula of type Time Entry Rule.

Contexts
The following are contexts available to formulas of this type:

» HWM_FFS_ID
» HWM_RULE_ID
» HWM_PROJECT_ID
» HWM_RESOURCE_ID
» HWM_SUMMATION_LEVEL
» HWM_RECORD_POSITION
For detailed information see Appendix 2: Contexts.

Database Items
None.

Input Variables
For detailed information see Appendix 6: Input Attributes

Use any attribute name in the NAME column of the TM_ATRB_FLDS_VL where attribute_category is equal to
TIME_BUILDING_BLOCK.

Example:

select NAME from HWM_TM_ATRB_FLDS_VL

where attribute_category = 'TIME_BUILDING_BLOCK'

Formula: WFM_PERIOD_MAXIMUM_TIME_ENTRY_RULE
The following fast formula associated with the Period Maximum Hours Template time entry rule template evaluates
the time entered on the time card to determine if the time reporter entered more hours than the specified threshold.

In the following example, the configuration sets a limit of 45 hours for the work week. If the time reporter enters more
than 45 hours, a warning or error message appears after the time reporter submits the time card. The time reporter
only sees a message if the time entered causes the fast formula to fail. If the time entered passes validation, no
message appears.

/* +======================================================================+

| Copyright (c) 2009 Oracle Corporation |

| Redwood Shores, California, USA |

| All rights reserved. |

7 | TIME AND LABOR FAST FORMULA REFERENCE GUIDE


+======================================================================+

* Formula Name : WFM_PERIOD_MAXIMUM_TIME_ENTRY_RULE

* Description: Formula that validates if reported time entries are

* greater than a defined maximum hours value. The maximum

* hours value and time attributes are inputs to the

* delivered formula.

* Formula Type: WORKFORCE_MANAGEMENT_REPOSITORY_RULES - FF Seed Data

* Detail: This maximum hours formula compares the number of hours

* defined in a time category with the defined limit value.

* If the number of hours is greater than the defined limit

* value, then the defined message is displayed. If no

* message is defined, then the default message is displayed.

* The message severity is defined as an output value

* associated with the displayed message.

* HWM_FF_TER_PERIOD_GT_MAX_ERR - HWM_FF_TER_PERIOD_GT_MAX_WRN

* Change History

* --------------

* Who Ver Date Description

*----------------- ------ ------------ -----------------------------------------

* David Cohanoff 08.02b 2012-APRIL-10 Created.

***************************************************************************/

default for measure(number) is 0

8 | TIME AND LABOR FAST FORMULA REFERENCE GUIDE


INPUTS ARE

measure(number)

/* Following 2 lines are required right after inputs for all OTL and HWM formulas */

ffs_id = GET_CONTEXT(HWM_FFS_ID, 0)

l_status = init_util(ffs_id , GET_CONTEXT(HWM_RULE_ID, 0) )

/* sum_lvl = GET_CONTEXT(HWM_SUMMATION_LEVEL, 'TIMECARD') */

rec_position = GET_CONTEXT(HWM_RECORD_POSITION, 'DETAIL')

process_empty_tc = Get_Rule_Hdr_Text(ffs_id ,'INCLUDE_EMPTY_TC', 'Y')

if (upper(process_empty_tc) = 'YES' or upper(process_empty_tc) = 'Y' ) then (

process_empty_tc = 'Y'

/* Fixed Values from Rule header */

sum_lvl = Get_Rule_Hdr_Text(ffs_id ,'RUN_SUMMATION_LEVEL', 'TIMECARD')

l_text = '(v3.08a- ' ||

' , sum_lvl=' || sum_lvl ||

' , rec_position =' || rec_position ||

' , ffs_id =' || TO_CHAR( ffs_id ) ||

' , measure =' || TO_CHAR( measure ) ||

')'

l_status = add_log (ffs_id ,l_text )

l_send_msg = 0

l_max_hr = get_fvalue_number (ffs_id ,'DEFINED_LIMIT', 0)

l_msg_cd = GET_FVALUE_TEXT (ffs_id ,'MESSAGE_CODE',


'HWM_FF_TER_PERIOD_GT_MAX_WRN')

l_time_category = GET_FVALUE_TEXT (ffs_id ,'WORKED_TIME_CONDITION', 'NULL')

9 | TIME AND LABOR FAST FORMULA REFERENCE GUIDE


wk_hrs_total_day = get_wrk_num (ffs_id , 'wk_hrs_total_day' , 0, 0 )

wk_hrs_total_tc = get_wrk_num (ffs_id , 'wk_hrs_total_tc' , 0, 0 )

l_hrs_total_day = wk_hrs_total_day + measure

l_hrs_total_tc = wk_hrs_total_tc + measure

is_create_msg = 'N'

if (sum_lvl = 'TIMECARD' AND l_hrs_total_tc > l_max_hr ) then (

is_create_msg = 'Y'

) ELSE IF (sum_lvl = 'DAY' AND l_hrs_total_day > l_max_hr ) then (

is_create_msg = 'Y'

) ELSE IF ( sum_lvl = 'DETAIL' AND measure > l_max_hr ) then (

is_create_msg = 'Y'

if ( is_create_msg = 'Y' and process_empty_tc <> 'Y') then (

if (rec_position = 'END_DAY' and wk_hrs_total_day = 0 ) then (

is_create_msg = 'N'

) if (rec_position = 'DETAIL' and measure = 0 ) then (

is_create_msg = 'N'

if ( is_create_msg = 'Y' ) then (

/* desfault l_msg_cd = Maximum hours exceeds {DEF_LIMIT} hours per week */

l_tkn1 = 'DEF_LIMIT'

l_val1 = TO_CHAR( l_max_hr )

l_msg_cd = l_msg_cd

OUT_MSG = get_output_msg1 ( 'FND' ,l_msg_cd ,l_tkn1 , l_val1 )

10 | TIME AND LABOR FAST FORMULA REFERENCE GUIDE


wk_hrs_total_day = l_hrs_total_day

wk_hrs_total_tc = l_hrs_total_tc

if (rec_position = 'END_DAY') then (

wk_hrs_total_day =0

) ELSE IF (rec_position = 'END_PERIOD') then (

wk_hrs_total_day =0

wk_hrs_total_tc =0

l_status = set_wrk_num (ffs_id , 'wk_hrs_total_day' , 0, wk_hrs_total_day)

l_status = set_wrk_num (ffs_id , 'wk_hrs_total_tc' , 0, wk_hrs_total_tc )

RETURN OUT_MSG

Fixed Parameters
Use the GET_RVALUE_xxxx function to extract fixed parameters associated with a rule.

The parameter name must be less than 30 alphanumeric characters. Fixed parameters automatically get populated
on the rule template Parameters page.

Valid Functions
The following are the valid functions for this formula:

» GET_RVALUE_NUMBER
» GET_RVALUE_TEXT
» GET_RVALUE_DATE

Return Variables
Naming standards for return variables must:

» Be no more than 30 characters.


» Meet fast formula naming standards.
The data type for return variables is TEXT.

Return variable names appear in the Output section of the rule template, where the administrator can assign
message severity.

11 | TIME AND LABOR FAST FORMULA REFERENCE GUIDE


Return Variable Name and Data Type Example:

Return Value Data Type

OUTPUT_MSG_TEXT Text

Formula: WFM_PERIOD_MINIMUM_TIME_ENTRY_RULE
The following fast formula associated with the Period Minimum Hours Template time entry rule template evaluates
the time entered on the time card to determine if the time reporter entered less hours than the specified threshold.

In the following example, the configuration sets a minimum of 20 hours for the work week. If the time reporter enters
less than 20 hours, a warning or error message appears after the time reporter submits the time card.

/* +======================================================================+

| Copyright (c) 2009 Oracle Corporation |

| Redwood Shores, California, USA |

| All rights reserved. |

+======================================================================+

* Formula Name : WFM_PERIOD_MINIMUM_TIME_ENTRY_RULE

* Description: Formula that validates if reported time entries are less

* than a defined minimum hours value. The minimum hours value

* and time attributes are inputs to the delivered formula.

* Formula Type: WORKFORCE_MANAGEMENT_REPOSITORY_RULES

* Detail: This minimum hours formula compares the number of hours

* defined in a time category with the defined limit value.

* If the number of hours is less than the defined limit

* value, the defined message is displayed. If no message

* is defined, the default message is displayed. The message

* severity is defined as an output value associated with

* the displayed message.

* HWM_FF_TER_PERIOD_LS_MIN_ERR - HWM_FF_TER_PERIOD_LS_MIN_WRN

12 | TIME AND LABOR FAST FORMULA REFERENCE GUIDE


*

* Change History

* --------------

* Who Ver Date Description

*----------------- ------ ------------ -----------------------------------------

* David Cohanoff 06.12 2012-JUN-19 Created.

***************************************************************************/

default for measure(number) is 0

INPUTS ARE

measure(number)

/* Following 2 lines are required right after inputs for all OTL and HWM formulas */

ffs_id = GET_CONTEXT(HWM_FFS_ID, 0)

l_status = init_util(ffs_id , GET_CONTEXT(HWM_RULE_ID, 0) )

rec_position = GET_CONTEXT(HWM_RECORD_POSITION, 'DETAIL')

/* Fixed Values from Rule header */

sum_lvl= Get_Rule_Hdr_Text(ffs_id ,'RUN_SUMMATION_LEVEL', 'TIMECARD')

process_empty_tc = Get_Rule_Hdr_Text(ffs_id ,'INCLUDE_EMPTY_TC', 'Y')

if (upper(process_empty_tc) = 'YES' or upper(process_empty_tc) = 'Y' ) then (

process_empty_tc = 'Y'

l_text = '(v3.08a- ' ||

' , sum_lvl=' || sum_lvl ||

13 | TIME AND LABOR FAST FORMULA REFERENCE GUIDE


' , rec_position =' || rec_position ||

' , ffs_id =' || TO_CHAR( ffs_id ) ||

' , measure =' || TO_CHAR( measure) ||

')'

l_status = add_log (ffs_id ,l_text )

l_send_msg = 0

/*

l_default_last_date = '01-JAN-1900'(DATE)

wk_date_last = get_wrk_date (ffs_id , 'wk_date_last' , 0, l_default_last_date )

*/

l_min_hr = get_fvalue_number (ffs_id ,'DEFINED_LIMIT', 0)

l_msg_cd = GET_FVALUE_TEXT (ffs_id ,'MESSAGE_CODE',


'HWM_FF_TER_PERIOD_LS_MIN_WRN')

l_time_category = GET_FVALUE_TEXT (ffs_id ,'WORKED_TIME_CONDITION', 'NULL')

wk_hrs_total_day = get_wrk_num (ffs_id , 'wk_hrs_total_day' , 0, 0 )

wk_hrs_total_tc = get_wrk_num (ffs_id , 'wk_hrs_total_tc' , 0, 0 )

l_hrs_total_day = wk_hrs_total_day + measure

l_hrs_total_tc = wk_hrs_total_tc + measure

is_create_msg = 'N'

is_ck_time = 'N'

l_Ck_hours = 0

if (sum_lvl = 'TIMECARD' and rec_position = 'END_PERIOD' ) then (

l_Ck_hours = l_hrs_total_tc

is_ck_time = 'Y'

) ELSE IF (sum_lvl = 'DAY' and rec_position = 'END_DAY' ) then (

l_Ck_hours = wk_hrs_total_day

is_ck_time = 'Y'

14 | TIME AND LABOR FAST FORMULA REFERENCE GUIDE


) ELSE IF (sum_lvl = 'DETAIL' and rec_position = 'DETAIL') then (

l_Ck_hours = measure

is_ck_time = 'Y'

if ( is_ck_time = 'Y') Then (

if (l_Ck_hours = 0 ) then (

if (process_empty_tc = 'Y' ) then (

is_create_msg = 'Y'

) ELSE IF ( l_Ck_hours < l_min_hr ) then (

is_create_msg = 'Y'

if ( is_create_msg = 'Y' ) then (

/* desfault l_msg_cd = Entered hours for period is less than {DEF_LIMIT} hours required for the
timecard period */

l_tkn1 = 'DEF_LIMIT'

l_val1 = TO_CHAR( l_min_hr )

l_msg_cd = l_msg_cd

OUT_MSG = get_output_msg1 ( 'FND' ,l_msg_cd ,l_tkn1 , l_val1 )

wk_hrs_total_day = l_hrs_total_day

wk_hrs_total_tc = l_hrs_total_tc

if (rec_position = 'END_DAY') then (

wk_hrs_total_day =0

) ELSE IF (rec_position = 'END_PERIOD') then (

15 | TIME AND LABOR FAST FORMULA REFERENCE GUIDE


wk_hrs_total_day =0

wk_hrs_total_tc =0

l_status = set_wrk_num (ffs_id , 'wk_hrs_total_day' , 0, wk_hrs_total_day)

l_status = set_wrk_num (ffs_id , 'wk_hrs_total_tc' , 0, wk_hrs_total_tc )

RETURN OUT_MSG

Fixed Parameters
Use the GET_RVALUE_xxxx function to extract the fixed parameters associated with a rule.

The parameter name must be less than 30 alphanumeric characters. Fixed parameters automatically get populated
on the rule template Parameters page.

Valid Functions
The following are the valid functions for this formula:

» GET_RVALUE_NUMBER
» GET_RVALUE_TEXT
» GET_RVALUE_DATE

Return Variables
Naming standards for return variables must:
» Be no more than 30 characters.
» Meet fast formula naming standards.
The return variable data type is TEXT.

Return variable names appear in the Output section of the rule template, where administrators can assign message
severity.

Return Variable Name and Data Type Example:

Return Value Data Type

OUTPUT_MSG_TEXT Text

16 | TIME AND LABOR FAST FORMULA REFERENCE GUIDE


Workforce Management Time Calculation Rules
Time calculation rules (TCR) use fast formula of type Time Calculation Rule.

Contexts
The following contexts are available to formulas of this type:

» HWM_FFS_ID
» HWM_RULE_ID
» HWM_PROJECT_ID
» HWM_RESOURCE_ID
» HWM_SUMMATION_LEVEL
» HWM_RECORD_POSITION

Database Items
None.

Input Variables
Use any attribute name in the NAME column of TM_ATRB_FLDS_VL where attribute_category is equal to
TIME_BUILDING_BLOCK.

Example:

select NAME from HWM_TM_ATRB_FLDS_VL

where attribute_category = 'TIME_BUILDING_BLOCK'

Formula: WFM_THRESHOLD_TIME_CALCULATION_RULE
The following fast formula associated with the Threshold time calculation rule template evaluates the total number of
hours that a time reporter enters on a time card. If the hours exceed a threshold, the results are a number above
and a number below the threshold. As part of the rule definition, the formula and template enable administrators to
associate time attributes with the values above and below the threshold value.

Time calculation results appear on the time card review page showing the number of hours below and over the
threshold as well as their defined time attributes, such as the Regular and Premium payroll time types, respectively.
The Regular and Premium time attributes definitions determine how time attributes are assigned to formula results.

Example: The time calculation rule is defined to pay hours over 40 at a premium. Depending on the time attribute
definitions, if the time reporter enters 45 hours, the time card review page could display the following:

» 40 hours below the threshold value of 40 with the Regular payroll time type and 5 hours above the threshold with
the Premium payroll time type
» 45 hours below the threshold with the Regular payroll time type and 5 hours above the threshold with the
Premium payroll time type.

17 | TIME AND LABOR FAST FORMULA REFERENCE GUIDE


/* +======================================================================+

| Copyright (c) 2009 Oracle Corporation |

| Redwood Shores, California, USA |

| All rights reserved. |

+======================================================================+

* Formula Name : WFM_THRESHOLD_TIME_CALCULATION_RULE

* Description: Formula that divides defined daily or weekly reported

* time into calculated time attributes for values above

* and below a defined threshold hours value. Reported time

* and specific time attribute results are inputs to the

* delivered formula.

* Formula Type: WFM TCR Threshold Rule - FF Seed Data

* Detail: This threshold formula takes the total hours for the day

* or week that is defined as work time in a time category

* and compares it with a threshold value. Hours above the

* threshold value are converted to a single pay time type.

* Hours under the threshold value either remain the same

* pay time type value or are converted into a new

* pay time type attribute.

* Change History

* --------------

* Who Ver Date Description

*----------------- ------ ------------ -----------------------------------------

* David Cohanoff 06.12b 2013-FEB-10 Created.

18 | TIME AND LABOR FAST FORMULA REFERENCE GUIDE


*

***************************************************************************/

default for measure(number) is 0

default for PayrollTimeType(text) is 'NULL'

INPUTS ARE

measure(number) ,

PayrollTimeType(text)

/* Following 2 lines are required right after inputs for all OTL and HWM formulas */

ffs_id = GET_CONTEXT(HWM_FFS_ID, 0)

l_status = init_util(ffs_id , GET_CONTEXT(HWM_RULE_ID, 0) )

/* sum_lvl = GET_CONTEXT(HWM_SUMMATION_LEVEL, 'TIMECARD') */

rec_position = GET_CONTEXT(HWM_RECORD_POSITION, 'DETAIL')

/* Fixed Values from Rule header */

sum_lvl= Get_Rule_Hdr_Text(ffs_id ,'RUN_SUMMATION_LEVEL', 'TIMECARD')

exec_type = Get_Rule_Hdr_Text(ffs_id ,'RULE_EXEC_TYPE', 'CREATE')

paytypeIn = PayrollTimeType

/* Fixed Values from Rule Input parameters */

max_hr = get_fvalue_number (ffs_id ,'DEFINED_LIMIT', 0)

19 | TIME AND LABOR FAST FORMULA REFERENCE GUIDE


time_category = GET_FVALUE_TEXT (ffs_id ,'WORKED_TIME_CONDITION', 'NULL')

create_yn = 'N'

if (upper(exec_type) = 'CREATE' ) then (

create_yn = 'Y'

wk_hrs_total_day = get_wrk_num (ffs_id , 'wk_hrs_total_day' , 0, 0 )

wk_hrs_total_tc = get_wrk_num (ffs_id , 'wk_hrs_total_tc' , 0, 0 )

tot_day = wk_hrs_total_day + measure

tot_tc = wk_hrs_total_tc + measure

tot_ck = 0

hr_ot =0

hr_reg =0

if (sum_lvl = 'TIMECARD' AND tot_tc > max_hr and max_hr > 0 ) then (

tot_ck = tot_tc

) ELSE IF (sum_lvl = 'DAY' AND tot_day > max_hr and max_hr > 0) then (

tot_ck = tot_day

) ELSE IF ( sum_lvl = 'DETAIL' AND measure > max_hr and max_hr > 0 ) then (

tot_ck = measure

if ( tot_ck > 0 ) then (

hr_ot = tot_ck - max_hr

if (hr_ot > measure ) then (

hr_ot = measure

hr_reg = 0

) else (

20 | TIME AND LABOR FAST FORMULA REFERENCE GUIDE


hr_reg = measure - hr_ot

if ( create_yn = 'Y') then (

hr_reg = measure

) else (

if ( measure > 0 ) then (

hr_reg = measure

if ( hr_reg > 0 ) then (

out_measure_under = hr_reg

if ( hr_ot > 0 ) then (

out_measure_over = hr_ot

wk_hrs_total_day = tot_day

wk_hrs_total_tc = tot_tc

if (rec_position = 'END_DAY') then (

wk_hrs_total_day =0

) ELSE IF (rec_position = 'END_PERIOD') then (

wk_hrs_total_day =0

wk_hrs_total_tc = 0

21 | TIME AND LABOR FAST FORMULA REFERENCE GUIDE


)

l_status = set_wrk_num (ffs_id , 'wk_hrs_total_day' , 0, wk_hrs_total_day)

l_status = set_wrk_num (ffs_id , 'wk_hrs_total_tc' , 0, wk_hrs_total_tc )

RETURN out_measure_under,

out_measure_over

Fixed Parameters
Use the GET_RVALUE_xxxx function to extract fixed parameters associated with a rule.

The parameter name must be less than 30 alphanumeric characters. Fixed parameters automatically get populated
on the rule template Parameters page.

Valid Functions
The following are the valid functions for this formula:
» GET_RVALUE_NUMBER
» GET_RVALUE_TEXT
» GET_RVALUE_DATE

Return Variables
Naming standards for return variables must:
» Be no more than 30 characters.
» Meet fast formula naming standards.
The data type is the same as the associated time attribute on the rule template Output page.

Return variable names appear in the Output section of the rule template. Return values get passed, or assigned, to
the Time building block attribute through the rule template Output page.

Return Variable Name and Data Type Example:

Return Value Data Type

OUT_MEASURE_UNDER Same type as associated attribute

OUT_MEASURE_OVER Same type as associated attribute

22 | TIME AND LABOR FAST FORMULA REFERENCE GUIDE


The delivered time calculation rule formula has two return values, OUT_MEASURE_UNDER and
OUT_MEASURE_OVER, for the values above and below the one threshold value, respectively. If the formula
allowed for two threshold values, then there would be three return values.

23 | TIME AND LABOR FAST FORMULA REFERENCE GUIDE


Appendix

Appendix 1: Formula Types


The following table describes different formula types available for workforce management formulas.

FORMULA_TYPE_NAME Description Available


Release
WORKFORCE_MANAGEMENT_TIME_ Administrators can select only formulas with this formula type when 11.1.8 and
CALCULATION_RULES creating time calculation rule templates. above
See Figure 1.
WORKFORCE_MANAGEMENT_TIME_E Administrators can select only formulas with this formula type when 11.1.8 and
NTRY_RULES creating time entry rule templates. above
See Figure 2
WORKFORCE_MANAGEMENT_SUBRO Fast formulas have many limitations, one of which is that functions or 11.1.8 and
UTINE procedures cannot be created inside the formula. This formula type is a above
workaround for that limitation.
Administrators use this formula type with formulas that provide specific
functionality for parent formulas. Since this formula type is not associated
with any rule template type, it cannot be selected when creating rule
templates. This formula can be called by the other formula types.
WORKFORCE_MANAGEMENT_ Very similar functionality to the 11.1.8 and
UTILITY WORKFORCE_MANAGEMENT_SUBROUTINE formula type. The above
WORKFORCE_MANAGEMENT_SUBROUTINE and
WORKFORCE_MANAGEMENT_ UTILITY formula types can be used
interchangeably. Using a correct type makes it much easier to determine
which formulas are function-specific and which ones are general utility for
all formulas

Figure 1: TCR template type with WORKFORCE_MANAGEMENT_TIME_CALCULATION_RULES formulas.

24 | TIME AND LABOR FAST FORMULA REFERENCE GUIDE


Figure 2: TER template type with WORKFORCE_MANAGEMENT_TIME_ ENTRY _RULES formulas.

25 | TIME AND LABOR FAST FORMULA REFERENCE GUIDE


Appendix 2: Contexts
The following table describes the different contexts available for workforce management formulas. All contexts listed
below are available for all formula types.

Context NAME Description Available


Release
HWM_FFS_ID The unique fast formula session ID is used by most workforce 11.1.8 and
management functions as a key identifier for logs and work area above
related record processing. This ID is associated with specific rule
processing by the rule engine.
See Appendix 3: Workforce Management Functions
HWM_SUMMATION_LEVEL Gets the summation level from the rule template page. This value 11.1.8 and
indicates how to summarize time cards. above
The following table describes the valid values.

Valid Value Description

DETAIL Process each record individually. Usually no


summation is required.

DAY Use to sum and calculate values on a daily basis.

TIMECARD Use to sum and calculate values for the entire


time card period.

HWM_RECORD_POSITION The record position value indicates the type of record being 11.1.8 and
processed. above
The following table describes the valid values.

Valid Value Description

DETAIL Detail record

END_DAY End of day record; enables day summation


calculation.

END_PERIOD End period record; the last record for the time
card

The time card records are passed to the fast formula in the following
sequence:
1. Detail records for day one of the time card, sorted in a
predefined order
2. End of day record for day one
3. Steps 1 and 2 repeat for all days of the time card period
4. End period record for the time card, it is the final record
passed from the time card
HWM_RULE_ID The rule ID is the key for rule currently being processed. This key is 11.1.8 and
used to get parameter values set in the rule and, in combination with above
HWM_FFS_ID, used to store and retrieve work area values.
HWM_PROJECT_ID The project ID associated with the time card record currently being 11.1.8 and
processed. above

HWM_RESOURCE_ID The resource ID or person ID associated with the time card record 11.1.8 and
currently being processed. above

26 | TIME AND LABOR FAST FORMULA REFERENCE GUIDE


Appendix 3: Workforce Management Functions
Appendix 3.1: Working Storage Area Functions
Important: Do NOT use fast formula working storage area methods, such as WSA_GET and WSA_SET. Fast
formula methods work only between fast formula calls. Since workforce management passes records from Java
programs and these values must be stored during the call, you must use the following workforce management
functions to store and retrieve values in between calls.

Function Description Available


Release
SET_WRK_NUM( Set the numeric value for the item called P_PARM_NAME. Any existing item with the 11.1.8 and
P_FFS_ID , same name is overwritten. above

P_PARM_NAME , Parameters:

P_PARM_SEQ , P_FFS_ID: Use the HWM_FFS_ID context (see Appendix 2: Contexts).

P_PARM_VALUE ) P_PARM_NAME: Any alphanumeric name.


P_PARM_SEQ: Set to 0 unless storing multiple values with the same PARM_NAME.
P_PARM_VALUE: Numeric value.
SET_WRK_DATE( Same as SET_WRK_NUM, except it is used to store date values. 11.1.8 and
P_FFS_ID , P_PARM_VALUE: Date value. above

P_PARM_NAME ,
P_PARM_SEQ ,
P_PARM_VALUE )
SET_WRK_TEXT( Same as SET_WRK_NUM, except it is used to store string values. 11.1.8 and
P_FFS_ID , P_PARM_VALUE: String value. above

P_PARM_NAME ,
P_PARM_SEQ ,
P_PARM_VALUE )
GET_WRK_TEXT( Get the stored value for the item called P_PARM_NAME. If there is no item called 11.1.8 and
P_FFS_ID , P_PARM_NAME, then return the default-value. The data type of the default value is above
the expected data type for the item.
P_PARM_NAME ,
Parameters:
P_PARM_SEQ ,
P_FFS_ID: Use the HWM_FFS_ID context (see Appendix 2: Contexts).
DEFVAL ) RETURN
VARCHAR2 P_PARM_NAME: Any alphanumeric name.
P_PARM_SEQ: Set to 0 unless storing multiple values with the same PARM_NAME.
DEFVAL: Default value
RETURN VARCHAR2: Return a varchar value
GET_WRK_NUM( Same as GET_WRK_TEXT, except it is used to return numeric values. 11.1.8 and
P_FFS_ID , above

P_PARM_NAME ,
P_PARM_SEQ ,
DEFVAL ) RETURN
NUMBER
GET_WRK_DATE( Same as GET_WRK_TEXT, except it is used to return date values. 11.1.8 and
P_FFS_ID , above

P_PARM_NAME ,
P_PARM_SEQ ,
DEFVAL ) RETURN
DATE

27 | TIME AND LABOR FAST FORMULA REFERENCE GUIDE


Appendix 3.2: Rule Parameter and Header Values Functions
Use the following workforce management functions to get rule header and parameter values. Any names used in a
rule parameter function appear as input parameter values on the rule template Parameters page.

Function Description Available


Release
GET_HDR_TEXT( Use this function to get values set in the Basic Information Section of the rule 11.1.8 and
P_RULE_ID , template Definition page. above

P_COLUMN_NAME , Parameters:

DEFVAL ) P_RULE_ID: Use HWM_RULE_ID context (see Appendix 3: Contexts)

RETURN VARCHAR2 P_COLUMN_NAME: Use one of these valid column names.

Column Name Description Possible Return Values

RUN_TBB_LEVEL Reporting level DAY, DETAIL,


TIMECARD

RULE_EXEC_TYPE Rule execution type CREATE, UPDATE

SUPPRESS_DUP_MSGS Suppress duplicate Y, N


messages display

INCLUDE_EMPTY_TC Process empty time Y, N


card

DEFVAL: Default value


RETURN VARCHAR2: Return varchar value
GET_RVALUE_NUMBER( Use this function to get numeric values; set in the Rule Parameters section of the 11.1.8 and
P_RULE_ID , rule. above
P_VALUE_NAME , Note: A rule template uses the name from P_VALUE_NAME to populate the
Parameters section of the rule template.
DEFVAL )
Parameters:
RETURN NUMBER
P_RULE_ID: Use the HWM_RULE_ID context (see Appendix 2: Contexts).
P_VALUE_NAME: Use upper case alpha characters and underscores only. The
rule template uses this name to populate the Formula Parameter Name section of
the Parameter page.
DEFVAL: Default value
RETURN NUMBER: Return numeric value

GET_RVALUE_TEXT( Same as GET_RVALUE_NUMBER, except it returns string values. 11.1.8 and


P_RULE_ID , above
P_VALUE_NAME ,
DEFVAL )
RETURN VARCHAR2
GET_RVALUE_DATE( Same as GET_RVALUE_NUMBER, except it returns date values. 11.1.8 and
P_RULE_ID , above
P_VALUE_NAME ,
DEFVAL )
RETURN DATE

Appendix 4.3: Miscellanies Functions

28 | TIME AND LABOR FAST FORMULA REFERENCE GUIDE


Function Description Available
Release
ADD_RLOG( Create a log for tracing and debug. Used in Analyze Rule Processing Details. All 11.1.8 and
P_FFS_ID , logs with this function appear in Analyze Rule Processing Details, in the Rule above
Processing Log column of the Processing Results section.
P_RULE_ID ,
Parameters:
P_LOG_TEXT )
P_FFS_ID: Use the HWM_FFS_ID context (see Appendix 2: Contexts).
P_RULE_ID: Use the HWM_RULE_ID context (see Appendix 2: Contexts).
P_LOG_TEXT: Any string for log/debug purposes.
GET_OUTPUT_MSG1(P_APP_SHO For TER formulas, use this function to format data repository message for output. 11.1.8 and
RT_NAME, above
Note: Any message that is passed as output for the data repository MUST use the
P_MESSAGE_NAME , appropriate GET_OUTPUT_MSG function for proper formatting.
TOKEN1_NAME , Use this function for the message code with a single token. It creates a single
TOKEN1_VALUE ) message string with one token for the output, formatted for workforce management
consumption.
RETURN VARCHAR2
Parameters:
P_APP_SHORT_NAME: 3-character application short name, in most cases FND
P_MESSAGE_NAME: The message code as defined in the FND_MESSAGES
table
TOKEN1_NAME: The token name as defined in in the FND_MESSAGES table
TOKEN1_VALUE: The token Value
RETURN VARCHAR2: Formatted message ready for output

Example:
message_name:
'HWM_FF_TER_PERIOD_GT_MAX_WRN'

message_text :
The hours entered for the period exceed the maximum limit
{DEF_LIMIT} defined for the time card.

from fnd_messages

P_MESSAGE_NAME: HWM_FF_TER_PERIOD_GT_MAX_WRN
TOKEN1_NAME: 'DEF_LIMIT'
TOKEN1_VALUE: 8

OUT_MSG = get_output_msg1 ( 'FND' , P_MESSAGE_NAME,


TOKEN1_NAME , TOKEN1_VALUE)
GET_OUTPUT_MSG2(P_APP_SHO For TER formulas, use this function to format the data repository message for 11.1.8 and
RT_NAME, output. above
P_MESSAGE_NAME , Same as GET_OUTPUT_MSG1, except for messages use two tokens.
TOKEN1_NAME ,
TOKEN1_VALUE ,
TOKEN2_NAME ,
TOKEN2_VALUE )
RETURN VARCHAR2

29 | TIME AND LABOR FAST FORMULA REFERENCE GUIDE


Function Description Available
Release
GET_OUTPUT_MSG( For TER formulas, use this function to format the data repository message for 11.1.8 and
P_APP_SHORT_NAME , output. above
P_MESSAGE_NAME ) Same as GET_OUTPUT_MSG1, except for messages with no tokens.
RETURN VARCHAR2

Appendix 5: Database Items


Note: Limited availability in release 11.1.9

User Entity Name: HWM_EMP_SCHD_EMPLOYMENT_SCHEDULE_UE

Data Null Multi


DBI Group Name Data Base Item Name Type Allowed Row

HWM_EMP_SCHD_AVAILABILITY_CODE HWM_EMP_SCHD_AVAILABILITY_CODE TN Y Y

HWM_EMP_SCHD_END_DATE_TIME HWM_EMP_SCHD_END_DATE_TIME DN Y Y

HWM_EMP_SCHD_MEASURE HWM_EMP_SCHD_MEASURE NN Y Y

HWM_EMP_SCHD_OBJECT_CATEGORY HWM_EMP_SCHD_OBJECT_CATEGORY TN Y Y

HWM_EMP_SCHD_OBJECT_ID HWM_EMP_SCHD_OBJECT_ID NN Y Y

HWM_EMP_SCHD_OBJECT_NAME HWM_EMP_SCHD_OBJECT_NAME TN Y Y

HWM_EMP_SCHD_OBJECT_TYPE HWM_EMP_SCHD_OBJECT_TYPE TN Y Y

HWM_EMP_SCHD_PERSON_ID HWM_EMP_SCHD_PERSON_ID NN Y Y

HWM_EMP_SCHD_START_DATE_TIME HWM_EMP_SCHD_START_DATE_TIME DN Y Y

HWM_EMP_SCHD_SUBRESOURCE_ID HWM_EMP_SCHD_SUBRESOURCE_ID NN Y Y

User Entity Name: HWM_PUB_SCHD_PUBLISHED_SCHEDULE_UE

Data Null Multi


DBI Group Name Data Base Item Name Type Allowed Row

HWM_PUB_SCHD_ACTIVITY_TYPE HWM_PUB_SCHD_ACTIVITY_TYPE TN Y Y

HWM_PUB_SCHD_DATE_FROM HWM_PUB_SCHD_DATE_FROM DN Y Y

HWM_PUB_SCHD_DATE_TO HWM_PUB_SCHD_DATE_TO DN Y Y

HWM_PUB_SCHD_MEASURE HWM_PUB_SCHD_MEASURE NN Y Y

HWM_PUB_SCHD_ORDER_ENTERED HWM_PUB_SCHD_ORDER_ENTERED NN Y Y

HWM_PUB_SCHD_START_TIME HWM_PUB_SCHD_START_TIME DN Y Y

HWM_PUB_SCHD_STOP_TIME HWM_PUB_SCHD_STOP_TIME DN Y Y

HWM_PUB_SCHD_SUBRESOURCE_ID HWM_PUB_SCHD_SUBRESOURCE_ID NN Y Y

HWM_PUB_SCHD_TCSMR_CONFIG_SET_ID HWM_PUB_SCHD_TCSMR_CONFIG_SET_ID NN Y Y

HWM_PUB_SCHD_TCSMR_SET_ID HWM_PUB_SCHD_TCSMR_SET_ID NN Y Y

HWM_PUB_SCHD_TM_REC_ID HWM_PUB_SCHD_TM_REC_ID NN N Y

HWM_PUB_SCHD_TM_REC_TYPE HWM_PUB_SCHD_TM_REC_TYPE TN Y Y

30 | TIME AND LABOR FAST FORMULA REFERENCE GUIDE


Data Null Multi
DBI Group Name Data Base Item Name Type Allowed Row

HWM_PUB_SCHD_TM_REC_VERSION HWM_PUB_SCHD_TM_REC_VERSION NN N Y

HWM_PUB_SCHD_UNIT_OF_MEASURE HWM_PUB_SCHD_UNIT_OF_MEASURE TN Y Y

Appendix 6: Input Attributes


Any attribute listed in HWM_TM_ATRB_FLDS_VL table can be use as an input for fast formula.
(SELECT NAME,DISPLAY_NAME, ATTRIBUTE_TYPE FROM HWM_TM_ATRB_FLDS_VL)

Input (Attribute Name) Description Data Type

AbsenceEntryId Absence Entry ID Number

EndDayDuration End Day Duration Number

EndOfBreakdown End Of Breakdown Timestamp

StartDayDuration Start Day Duration Number

DurationPaid Duration Paid Number

AbsenceType Absence Management Type Number

AbsenceReason Absence Type Reason Not applicable

Fields Fields Not applicable

PJC_EXPENDITURE_TYPE_ID Expenditure Type Number

PJC_SYSTEM_LINKAGE_FUNCTION Expenditure Type Class Varchar

PJC_EXPENDITURE_TYPE_NAME Expenditure Type Name Varchar

Day Day Varchar

PeriodId Time Card Period Number

Identifier Identifier Varchar

PYR_Appropriation Appropriation Not applicable

Cost Cost Varchar

CostSegment Cost Segment Varchar

PYR_Department Department Not applicable

PYR_Fund Fund Not applicable

PYR_Funding Source Funding Source Not applicable

PYR_Grant Grant Not applicable

InputValue Input Values Varchar

PYR_Object Object Not applicable

PYR_Organization Organization Not applicable


Example of Payment Rate for element
PYR_Payment Rate(e.g., BAT_PAY_TL_Regular) BAT_PAY_TL_Regular Not applicable

PayrollTimeType Payroll Time Type Varchar

e.g., PYR_Peddi Over Time Loc3_City Peddi Over Time Loc3_City Not applicable

PYR_Periodicity Periodicity Not applicable

31 | TIME AND LABOR FAST FORMULA REFERENCE GUIDE


Input (Attribute Name) Description Data Type

PYR_Program Program Not applicable

PYR_Project Project Not applicable

PYR_Rate Amount(e.g., BAT_PAY_TL_Regular) Rate Amount e.g., BAT_PAY_TL_Regular Not applicable

PYR_UOM UOM Not applicable

PJC_BILLABLE_FLAG Billable Varchar

PJC_PROJECT_ID Project Number

PJC_PROJECT_UNIT Project Unit Number

PJC_TASK_ID Task Number

PJC_WORK_TYPE_ID Work Type Number

ZmmShiftId Library Shift Id Number

ShiftOrigin Shift Origin Varchar

BUSINESS_UNIT Business Unit Number

ORGANIZATION_ID Department Number

ENTERPRISE_ID Enterprise ID Number

LDG_ID Legislative Data Group Number

EstimatedStartDate Estimated Start Date Timestamp

SubresourceId Assignment Number

Comment Comment Varchar

TimeConsumerConfigurationSet Consumer Configuration Set Number

TimeConsumerSet Consumer Set Number

Measure Hours Number

Resource Person Number

ResourceType Person Type Varchar

StartTime Start Time Timestamp

StopTime Stop Time Timestamp

BuildingBlockType Time Entry Increment Varchar

TimeReporter Time Reporter Number

UnitOfMeasure Unit Of Measure Varchar

ActivityEventTime Activity Event Time Timestamp

ActivityType Activity Type Varchar

OrderEntered Order Entered Number

RefDate Reference Date Date

TimeRecordType Time Record Type Varchar

eGroupTypeId Group Type Number

LayerTimeRecordGroupId Layer Group Number

LayerTimeRecordGroupVersion Layer Group Version Number

32 | TIME AND LABOR FAST FORMULA REFERENCE GUIDE


Oracle Corporation, World Headquarters Worldwide Inquiries
500 Oracle Parkway Phone: +1.650.506.7000
Redwood Shores, CA 94065, USA Fax: +1.650.506.7200

C ON N E C T W I TH U S

blogs.oracle.com/oracle Copyright © 2014, Oracle and/or its affiliates. All rights reserved. This document is provided for information purposes only, and the
contents hereof are subject to change without notice. This document is not warranted to be error-free, nor subject to any other
facebook.com/oracle warranties or conditions, whether expressed orally or implied in law, including implied warranties and conditions of merchantability or
fitness for a particular purpose. We specifically disclaim any liability with respect to this document, and no contractual obligations are
formed either directly or indirectly by this document. This document may not be reproduced or transmitted in any form or by any
twitter.com/oracle means, electronic or mechanical, for any purpose, without our prior written permission.

oracle.com Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.

Intel and Intel Xeon are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are used under license and
are trademarks or registered trademarks of SPARC International, Inc. AMD, Opteron, the AMD logo, and the AMD Opteron logo are
trademarks or registered trademarks of Advanced Micro Devices. UNIX is a registered trademark of The Open Group. 0315

You might also like