0% found this document useful (0 votes)
8 views4 pages

GNB_GL_ORGANIZATION Validation Logic

Uploaded by

niyaz99
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views4 pages

GNB_GL_ORGANIZATION Validation Logic

Uploaded by

niyaz99
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

/*

* Formula Name : GNB_GL_ORGANIZATION_VALIDATION


* Formula Type : Time Entry Rules
* Description : The formula validates whether the GNB_GL_ORGANIZATION is
00001 or blank. If GNB_GL_ORGANIZATION is 00001 or blank, then the error message is
appeared.
*
* Change History
* --------------
* Who Version Date Description
* ----------- ------ ---------- ---------------
* Kalyan Mallick 1.0 07-NOV-24 Created
***************************************************************************/

DEFAULT FOR HWM_CTXARY_RECORD_POSITIONS is EMPTY_TEXT_NUMBER


DEFAULT FOR HWM_CTXARY_HWM_MEASURE_DAY is EMPTY_NUMBER_NUMBER
DEFAULT FOR PayrollTimeType is EMPTY_TEXT_NUMBER
DEFAULT FOR AbsenceType is EMPTY_NUMBER_NUMBER
DEFAULT FOR measure is EMPTY_NUMBER_NUMBER
DEFAULT FOR StartTime is EMPTY_DATE_NUMBER
DEFAULT FOR SubresourceId is EMPTY_NUMBER_NUMBER
DEFAULT FOR HWM_PER_ASG_PERSON_ID is 0
DEFAULT FOR GD_GNB_GL_ORGANIZATION_CHAR is EMPTY_TEXT_NUMBER
DEFAULT FOR PYR_GNB_GL_ORGANIZATION is EMPTY_TEXT_NUMBER

INPUTS ARE
HWM_CTXARY_RECORD_POSITIONS,
HWM_CTXARY_HWM_MEASURE_DAY,
PayrollTimeType,
AbsenceType,
measure,
StartTime,
SubresourceId,
GD_GNB_GL_ORGANIZATION_CHAR,
PYR_GNB_GL_ORGANIZATION

/* 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 = 'GNB_SHORT_TERM_ACTING_PAY' || ' - v115.1125 '
rLog = add_rlog (ffs_id, rule_id, '>>> Enter - ' || ffName )

/* ----------- constant values -------- */


/* ------------------------------------- */
NullDate = '01-JAN-1900'(DATE)
NullDateTime = '1900/01/01 00:00:00' (date)
NullText = '**FF_NULL**'

RecPositoinEoPeriod = 'END_PERIOD'
RecPositoinEoDay = 'END_DAY'
RecPositoinDetail = 'DETAIL'

sumLvlTimeCard = 'TIMECARD'
sumLvlDay = 'DAY'
sumLvlDetail = 'DETAIL'

TimeRecordType_MEASURE = 'MEASURE'
TimeRecordType_RANGE = 'RANGE'
/* ----------- Context value -------- */
/* ------------------------------------ */
measure_period = GET_CONTEXT(HWM_MEASURE_PERIOD, 0)

/* ----------- Rule Header parameters -------- */


/* -------------------------------------------- */
hSumLvl= Get_Hdr_Text(rule_id, 'RUN_SUMMATION_LEVEL', 'TIMECARD')
hExecType = Get_Hdr_Text(rule_id,'RULE_EXEC_TYPE', 'CREATE')

hCreateYn = 'N'
if (upper(hExecType) = 'CREATE' ) then (
hCreateYn = 'Y'
)

l_status = add_rlog (ffs_id , rule_id ,'Rule Header and Context:' ||


' , ffs_id =' || TO_CHAR( ffs_id ) ||
' , rule_id =' || TO_CHAR( rule_id ) ||
' , measure_period=' || TO_CHAR( measure_period )
||
' , hSumLvl=' || hSumLvl ||
' , hExecType=' || hExecType ||
' , hCreateYn=' || hCreateYn )

/* ----------- Rule input parameters -------- */


/* ------------------------------------------- */
pCategoryId = get_rvalue_number (rule_id ,'WORKED_TIME_CONDITION', 0)
pMaxHrs = get_rvalue_number (rule_id ,'DAILY_LIMIT', 0)

l_status = add_rlog (ffs_id , rule_id , 'Rule Parameters: ' ||


' , pMaxHrs=' || TO_CHAR( pMaxHrs ) ||
' , pCategoryId =' || TO_CHAR( pCategoryId ) )

/* ----------- initialize output variables -------- */


/* ------------------------------------------------- */

MEASURE_ACT = EMPTY_NUMBER_NUMBER
MEASURE_REG_OFF = EMPTY_NUMBER_NUMBER
OUT_ASSIGNMENT_ID_ACT = EMPTY_TEXT_NUMBER
OUT_ASSIGNMENT_ID_REG = EMPTY_TEXT_NUMBER

/* ----------- Temp Workarea variables -------- */


/* --------------------------------------------- */
wMaAry = HWM_CTXARY_RECORD_POSITIONS.count
rLog = add_rlog (ffs_id, rule_id, 'Start bulk process - wMaAry=' ||
TO_CHAR( wMaAry ) )
wkTotalHrsDay = 0
wkTotalHrsTc = 0
nidx = 0

/* ----------- Loop through current Time Card(POJO) Main Logic -------- */


/* -------------------------------------------------------------------- */
WHILE (nidx < wMaAry ) LOOP
(
nidx = nidx + 1
tcMeasure = 0
tcMeasureDay = 0
tcRecPosition = NullText
tcPayrolltimetype = NullText
tcAbsenceType = -1
tcStartTime = nullDate
tcSubresourceId = 0
tcSubresourceId_Reg = 0
tcGD_GNB_GL_ORGANIZATION_CHAR = NullText

l_person_id = HWM_PER_ASG_PERSON_ID
tcRecPosition = HWM_CTXARY_RECORD_POSITIONS[nidx]
l_timecard_start_date = GET_CONTEXT(HWM_CTX_SEARCH_START_DATE, NullDate)
l_timecard_end_date = GET_CONTEXT(HWM_CTX_SEARCH_END_DATE, NullDate)

if ([Link](nidx) ) then ( tcMeasure = MEASURE[nidx] )


if (HWM_CTXARY_HWM_MEASURE_DAY.exists(nidx) ) then ( tcMeasureDay =
HWM_CTXARY_HWM_MEASURE_DAY[nidx] )
if ([Link](nidx)) then (tcPayrolltimetype =
PAYROLLTIMETYPE[nidx])
if ([Link](nidx)) then (tcAbsenceType = ABSENCETYPE[nidx])
if ([Link](nidx)) then (tcStartTime = StartTime[nidx])
if ([Link](nidx)) then (tcSubresourceId = SubresourceId[nidx])
if (1 = 1) then (tcGD_GNB_GL_ORGANIZATION_CHAR =
GD_GNB_GL_ORGANIZATION_CHAR[nidx])

/*tcGD_GNB_GL_ORGANIZATION_CHAR = GD_GNB_GL_ORGANIZATION_CHAR*/
VALID = 'Y'
IF length(tcGD_GNB_GL_ORGANIZATION_CHAR) >=1 THEN
tcGD_GNB_GL_ORGANIZATION_CHAR = tcGD_GNB_GL_ORGANIZATION_CHAR
ELSE tcGD_GNB_GL_ORGANIZATION_CHAR = '00000'
VALID = 'Y'
rLog = add_rlog (ffs_id, rule_id, 'Tc_Inputs #: ' || TO_CHAR( nidx ) ||
'; measure=' ||
TO_CHAR( tcMeasure ) ||
'; measureDay=' ||
TO_CHAR( tcMeasureDay ) ||
'; payrolltimetype=' ||
tcPayrolltimetype ||
'; AbsenceType=' ||
TO_CHAR(tcAbsenceType) ||
'; StartTime=' ||
TO_CHAR(tcStartTime) ||
'; tcSubresourceId=' ||
TO_CHAR(tcSubresourceId) ||
'; l_person_id=' ||
TO_CHAR(l_person_id)||
'; tcSubresourceId_Reg=' ||
TO_CHAR(tcSubresourceId_Reg) ||
'; tcGD_GNB_GL_ORGANIZATION_CHAR='
|| tcGD_GNB_GL_ORGANIZATION_CHAR)

If (tcGD_GNB_GL_ORGANIZATION_CHAR = '00001' or tcGD_GNB_GL_ORGANIZATION_CHAR


= '00000') Then
(
VALID = 'N'
OUT_MSG = 'GNB_GL_ORGANIZATION_ERROR_FF'
)
)

rLog = add_rlog (ffs_id, rule_id, '<< Exit - ' || ffName )

RETURN OUT_MSG

Common questions

Powered by AI

The formula processes time card records by iterating over the array HWM_CTXARY_RECORD_POSITIONS and applying a series of checks to each record. It retrieves context-specific information to guide its processing, such as start and end dates for timecards. It evaluates various metrics like tcMeasure and tcPayrolltimetype to carry out validations. This process ensures each time card record is independently evaluated and validated, preserving data integrity and compliance within established rules .

The formula ensures adaptivity to different input scenarios by employing defaults, contextual data retrieval, and conditional expressions tailored to check the presence or absence of expected inputs. It dynamically adjusts its operations based on available inputs and context variables, assigning default values or skipping processing steps when necessary. This flexibility helps maintain operational robustness, allowing the formula to handle a range of variable input scenarios effectively .

The formula triggers the error message if the variable 'tcGD_GNB_GL_ORGANIZATION_CHAR' is set to '00001' or '00000'. This occurs within a loop that iterates through input values, setting tcGD_GNB_GL_ORGANIZATION_CHAR based on the GNB_GL_ORGANIZATION_CHAR input, or defaults it to '00000' if the input is insufficient. When these specific values ('00001' or '00000') are detected, the VALID flag is set to 'N', leading to the assignment of the error message 'GNB_GL_ORGANIZATION_ERROR_FF' .

The formula handles null or default values by setting defaults for various variables, such as assigning '00000' to tcGD_GNB_GL_ORGANIZATION_CHAR when its length is less than one. This approach is critical to ensure that the validation logic proceeds correctly without encountering null errors, providing a fail-safe mechanism against incomplete or missing data .

The primary function of the GNB_GL_ORGANIZATION_VALIDATION formula is to validate the value of the GNB_GL_ORGANIZATION. Specifically, it checks if the GNB_GL_ORGANIZATION is '00001' or blank. If it is either of these values, an error message 'GNB_GL_ORGANIZATION_ERROR_FF' is triggered .

The formula integrates context data by using functions such as GET_CONTEXT to retrieve contextual information like measure_period and rule_id. These context variables provide necessary dynamic data that influence the formula's operations and decisions, allowing it to adapt based on broader organizational and rule-specific parameters. This integration enhances the formula's ability to perform nuanced validations and maintain accurate record processing .

The rLog add_rlog function serves a crucial role in logging and debugging by systematically recording operational details and validation checks. It logs entries at critical points, such as entering and exiting main logic loops, outlining rule parameters, indicating the start of bulk processes, and detailing input validation results. This logging capability assists in monitoring formula operations and diagnosing issues promptly .

The loop structure in the formula iterates through the array HWM_CTXARY_RECORD_POSITIONS, applying validation checks to each entry. For each index in the loop, the formula retrieves relevant input values, assigns them to temporary variables, and checks the validity of the GNB_GL_ORGANIZATION by examining the value of tcGD_GNB_GL_ORGANIZATION_CHAR. If it finds a disallowed value, it updates the VALID status and assigns an error message, ensuring comprehensive validation across multiple records .

The criteria for setting the 'VALID' flag to 'N' are based on the value of tcGD_GNB_GL_ORGANIZATION_CHAR. If this character variable equals '00001' or '00000', the formula sets the VALID flag to 'N' and assigns the error message 'GNB_GL_ORGANIZATION_ERROR_FF'. This condition explicitly checks for these specific disallowed organizational codes to trigger error handling .

Variables defined with 'DEFAULT FOR' establish initial values for various parameters, such as EMPTY_TEXT_NUMBER or EMPTY_DATE_NUMBER, which ensure that uninitialized variables do not disrupt the formula's logic. 'INPUTS ARE' specifies the external inputs to the formula, such as HWM_CTXARY_RECORD_POSITIONS and GD_GNB_GL_ORGANIZATION_CHAR, which provide the necessary data for processing and validation tasks. These constructs are essential to ensure reliable and predictable operations within the formula .

You might also like