Sample Fast Formula with New Time Balance Database Item
This sample formula includes the new database item created from these example time configurations.
Example Balance Dimension Configuration
Here's the balance dimension configuration used in the sample formula:
Field | Example Configuration Value |
---|---|
Name | Reg Hrs by Person
|
Dimension Level | Person |
Period Type | Repeating Period |
Time Period | Biweekly Starting Sunday |
The application-generated suffix, which forms part of the database item name, is _REG_HRS_BY_PERSON_PER_RP.
Example Balance Definition Configuration
Here's the balance definition configuration used in the sample formula:
Field | Example Configuration Value |
---|---|
Name | Reg Hrs Time Bal Def
|
Entry Unit of Measure | Hours |
Balance Dimension |
This selection associates the dimension suffix (_REG_HRS_BY_PERSON_PER_RP) with the time balance definition. |
Effective Start Date | January 1, 2018 |
Time Category Name | Reg Hrs
|
Add or Subtract | Add |
The application-generated dimension, or database item, name is REG_HRS_TIME_BAL_DEF_REG_HRS_BY_PERSON_PER_RP.
Sample Formula
Here's the sample formula that uses the example balance definition:
DEFAULT FOR HWM_CTXARY_RECORD_POSITIONS is EMPTY_TEXT_NUMBER
DEFAULT FOR StartTime is EMPTY_DATE_NUMBER
DEFAULT FOR StopTime is EMPTY_DATE_NUMBER
default FOR REG_HRS_TIME_BAL_DEF_REG_HRS_BY_PERSON_PER_RP is 0
INPUTS ARE HWM_CTXARY_RECORD_POSITIONS, measure ,StartTime ,StopTime
ffs_id = GET_CONTEXT(HWM_FFS_ID, 0)
rule_id = GET_CONTEXT(HWM_RULE_ID, 0)
NullDate = '01-JAN-1900'(DATE)
NullText = '**FF_NULL**'
groupTypeID = 101
out_msg_ary = EMPTY_TEXT_NUMBER
ctxPersonId = GET_CONTEXT(HWM_RESOURCE_ID, 0)
ctxPeriodEndTime = GET_CONTEXT(HWM_CTX_PERIOD_END_DATE, NullDate)
pMaxHr = get_rvalue_number (rule_id ,'DEFINED_LIMIT', 0)
pMsgCd = ger_rvalue_text (rule_id ,'MESSAGE_CODE', 'HWM_FF_TER_PERIOD_GT_MAX_WRN')
tcRecCount = HWM_CTXARY_RECORD_POSITIONS.count
if (tcRecCount > 0 ) then
(
balValueCurCHANGE_CONTEXTS(EFFECTIVE_DATE = ctxPeriodEndTime, PERSON_ID = ctxPersonId, GRP_TYPE_ID = groupTypeId) = 0
(
IF (REG_HRS_TIME_BAL_DEF_REG_HRS_BY_PERSON_PER_RP WAS NOT DEFAULTED) THEN
(
balValueCur = REG_HRS_TIME_BAL_DEF_REG_HRS_BY_PERSON_PER_RP
rLog = add_rlog (ffs_id, rule_id, 'Balance Value: ' || TO_CHAR(balValueCur) ||
' = DBI_CONTEXTS: EFFECTIVE_DATE= '||
TO_CHAR( GET_CONTEXT(EFFECTIVE_DATE, nullDate) ) ||
', PERSON_ID=' || TO_CHAR( GET_CONTEXT(PERSON_ID, 0) ) ||
', GRP_TYPE_ID=' || TO_CHAR( GET_CONTEXT(GRP_TYPE_ID,0) ) )
)
) /* Change Context */
if (balValueCur > pMaxHr ) then (
out_msg_ary[tcRecCount] = get_output_msg1 ( 'FND ,pMsgCd ,'DEF_LIMIT' , TO_CHAR( pMaxHr ) )
)
)
RETURN out_msg_ary