This formula evaluates whether a participant has an eligible child by checking the relationship type (C
for child) and the effective date range for each relationship. If any relationship with the type “C” (child) exists within the current date’s effective date range, the participant is considered eligible.
/***********************************************************
FORMULA NAME : BEN_ELIGIBLE_CHILD_EXIST
FORMULA TYPE : Participant and Rate Eligibility
DESCRIPTION :
--------------------------------------------------------------
*************************************************************/
DEFAULT FOR PER_PER_DATE_OF_BIRTH IS '1951-01-01' (DATE)
DEFAULT FOR BEN_OPT_NAME IS ' '
DEFAULT FOR c_count IS 0
DEFAULT_DATA_VALUE for PER_PER_CONT_REL_CONTACT_TYPE is 'NA'
DEFAULT_DATA_VALUE for PER_PER_CONT_REL_CONTACT_PERSON_ID is 0
DEFAULT_DATA_VALUE for PER_PER_CONT_REL_EFFECTIVE_START_DATE is '1901/01/01' (date)
DEFAULT_DATA_VALUE for PER_PER_CONT_REL_EFFECTIVE_END_DATE is '1901/01/01' (date)
ELIGIBLE='N'
c_count=0
i=1
d_current_date=get_context(effective_date, '1901/01/01'(date))
log = ess_log_write('l_contextEffectiveDate =>'+ to_char(d_current_date))
WHILE PER_PER_CONT_REL_CONTACT_TYPE.exists(i)
LOOP
(
IF d_current_date >= PER_PER_CONT_REL_EFFECTIVE_START_DATE[i] and d_current_date <= PER_PER_CONT_REL_EFFECTIVE_END_DATE[i] THEN
(
IF (PER_PER_CONT_REL_CONTACT_TYPE[i]='C')
THEN
(
log = ess_log_write(PER_PER_CONT_REL_CONTACT_TYPE[i])
l_person_id=PER_PER_CONT_REL_CONTACT_PERSON_ID[i]
c_count=c_count+1
)
)
i=i+1
)
log = ess_log_write( to_char(c_count))
If c_count > 0 then
ELIGIBLE = 'Y'
log = ess_log_write(ELIGIBLE)
return ELIGIBLE