Documente Academic
Documente Profesional
Documente Cultură
Time and Labor Array Processing Formulas Compared with Normal Formulas 2
Main Difference 2
Output 2
Samples 2
Formulas 3
Formula: WFM_THRESHOLD_TIME_CALCULATION_RULE_AP 3
Formula: WFM_THRESHOLD_TIME_CALCULATION_RULE 6
A formula can return more than one value to the calling program. Different programs that call the
formula expect outputs to return differently. Based on the formula type, the number and data type of
values to return are already defined.
» Some programs expect the defined names for outputs: the location of an output in the return
statement does not matter. If defined names are expected and the formula does not use the
expected names, the process errors out at run time.
» Some programs expect the output to return by location; in this case the name of the output does not
matter.
Main Difference
With normal fast formulas, the rule processing engine calls the formula for each day and detail time entry on the time
card. Each call only passes information about a single entry to the formula. With AP fast formulas, the rule
processing engine calls the formula only once. The single call passes all relevant time attributes for the entire time
card. This behavior significantly reduces the number of calls to the middle tier and improves processing
performance. Also, AP formulas are flexible and enable developers to loop through time card data in various ways,
with more control over the process.
All formulas ending in _AP are array processing formulas. All formulas without this suffix are normal formulas.
Output
AP formula output returns values in an array format for the entire time card. Normal formula output returns values
one record at time. The final results are exactly the same for the AP and normal formulas.
Samples
These delivered formulas and rule templates, composed of these formulas, are perfect examples of AP and normal
formulas and templates. They both generate the exact same result:
Formula: WFM_THRESHOLD_TIME_CALCULATION_RULE_AP
/* +======================================================================+
| Copyright (c) 2009 Oracle Corporation |
| Redwood Shores, California, USA |
| All rights reserved. |
+======================================================================+
*
* Formula Name : WFM_THRESHOLD_TIME_CALCULATION_RULE_AP
*
* Formula Type: Time Calculation rule
*
*
* Description: Divides reported daily or period time into calculated
* time attributes for hours above and below defined
* threshold hours. Reported time and specific time attribute
* results are inputs to the delivered formula. This formula
* uses an array to process time card data.
*
* Detail: Compares the total time category hours for the day or
* period to the threshold value. Hours above the threshold
* are converted to a single pay time type. Hours under the
* threshold either remain the same pay time type value or
* are converted into a new pay time type attribute.
*
*
*
* Change History
* --------------
* Default input values are set as
* Who Ver Date Description Array Data type
*----------------- ------ ------------ -----------------------------------------
EMPTY_TEXT_NUMBER,
* David Cohanoff 206.12 2013-FEB-10 Created. EMPTY_DATE_NUMBER, and
* EMPTY_NUMBER_NUMBER.
***************************************************************************/
DEFAULT FOR HWM_CTXARY_RECORD_POSITIONS is EMPTY_TEXT_NUMBER
DEFAULT FOR HWM_CTXARY_HWM_MEASURE_DAY is EMPTY_NUMBER_NUMBER
DEFAULT FOR measure is EMPTY_NUMBER_NUMBER
INPUTS ARE
HWM_CTXARY_RECORD_POSITIONS,
HWM_CTXARY_HWM_MEASURE_DAY, Required inputs for all AP formulas are
measure HWM_CTXARY_RECORD_POSITIONS and
HWM_CTXARY_HWM_MEASURE_DAY.
/* Following 2 lines are required right after inputs for all OTL and HWM formulas */
ffs_id = GET_CONTEXT(HWM_FFS_ID, 0)
rule_id = GET_CONTEXT(HWM_RULE_ID, 0)
ffName = 'WFM_THRESHOLD_TIME_CALCULATION_RULE_AP' || ' - v115.1106 '
rLog = add_rlog (ffs_id, rule_id, '>>> Enter - ' || ffName )
NullDate = '01-JAN-1900'(DATE)
NullText = '--NULL--'
measure_period = GET_CONTEXT(HWM_MEASURE_PERIOD, 0)
hCreateYn = 'N'
if (upper(hExecType) = 'CREATE' ) then (
hCreateYn = 'Y'
)
wMaAry = HWM_CTXARY_RECORD_POSITIONS.count
rLog = add_rlog (ffs_id, rule_id, 'Start bulk process - wMaAry=' || TO_CHAR( wMaAry ) )
out_measure_ary_under = EMPTY_NUMBER_NUMBER
out_measure_ary_over = EMPTY_NUMBER_NUMBER
Output data types set as Array
Data type:
wkTotalHrsDay = 0 EMPTY_TEXT_NUMBER,
wkTotalHrsTc = 0 EMPTY_DATE_NUMBER, and
nidx = 0 EMPTY_NUMBER_NUMBER.
WHILE (nidx < wMaAry ) LOOP
(
aiMeasure = 0
aiRecPosition = NullText
nidx = nidx + 1
if (MEASURE.exists(nidx) ) then ( Loop through time card and process
aiMeasure = MEASURE[nidx] records by selecting individual input
) attributes defined in the input section,
such as Measure
aiMeasureDay = 0
if (HWM_CTXARY_HWM_MEASURE_DAY.exists(nidx) ) then (
aiMeasureDay = HWM_CTXARY_HWM_MEASURE_DAY[nidx]
)
aiRecPosition = HWM_CTXARY_RECORD_POSITIONS[nidx]
ocMeasure_under = -9999
ocMeasure_over = -9999
CALL_FORMULA ('WFM_THRESHOLD_TIME_CALCULATION_RULE_SUB'
, ffs_id > 'ffs_id'
, rule_id > 'rule_id'
, hSumLvl > 'hSumLvl'
, hCreateYn > 'hCreateYn'
, measure_period > 'measurePeriod'
, aiMeasureDay > 'measureDay'
, aiRecPosition > 'recPosition'
, wkTotalHrsDay > 'wkTotalHrsDay'
)
)
/* +======================================================================+
| Copyright (c) 2009 Oracle Corporation |
| Redwood Shores, California, USA |
| All rights reserved. |
+======================================================================+
*
* Formula Name : WFM_THRESHOLD_TIME_CALCULATION_RULE
*
* Formula Type: WFM TCR Threshold Rule - FF Seed Data
*
* Description: Divides reported daily or period time into calculated
* time attributes for hours above and below defined threshold
* hours. Reported time and specific time attribute results
* are inputs to the delivered formula.
*
* Detail: Compares the total time category hours for the day or
* period to the threshold value. Hours above the threshold
* are converted to a single pay time type. Hours under
* the threshold 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 206.12 2013-FEB-10 Created.
*
*
**************************************************************************/
default for measure(number) is 0
Default input and input variable value
data type is single Number, Date, or Text
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)
rule_id = GET_CONTEXT(HWM_RULE_ID, 0)
l_status = add_rlog (ffs_id , rule_id , 'WFM_THRESHOLD_TIME_CALCULATION_RULE v104.0525 '
)
create_yn = 'N'
if (upper(exec_type) = 'CREATE' ) then (
create_yn = 'Y'
)
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
)
) else (
if ( measure > 0 ) then (
hr_reg = measure
)
wk_hrs_total_day = tot_day
wk_hrs_total_tc = tot_tc
RETURN out_measure_under,
out_measure_over
CONNECT W ITH US
blogs.oracle.com/oracle
Copyright © 2018, 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 means,
twitter.com/oracle 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. 0318