Friday 21 September 2018

Fusion HCM - Managing an Array Type Fast Formula

Below is a Sample Array Type Fast Formula :

DEFAULT_DATA_VALUE FOR PER_HIST_ASG_ASSIGNMENT_ID IS 0
DEFAULT_DATA_VALUE FOR PER_HIST_ASG_ASSIGNMENT_TYPE IS 'x'
DEFAULT_DATA_VALUE FOR PER_HIST_ASG_EFFECTIVE_START_DATE IS '1951/01/01 00:00:00' (DATE)
DEFAULT_DATA_VALUE FOR PER_HIST_ASG_EFFECTIVE_END_DATE IS '4712/12/31 00:00:00' (DATE)
DEFAULT_DATA_VALUE FOR PER_HIST_ASG_PRIMARY_FLAG IS 'x'
DEFAULT_DATA_VALUE FOR PER_HIST_ASG_PRIMARY_WORK_REL_FLAG IS 'x'
DEFAULT_DATA_VALUE FOR PER_HIST_ASG_USER_PERSON_TYPE IS 'x'
DEFAULT FOR PER_ASG_ATTRIBUTE2 IS 'NONE'


l_effective_date = GET_CONTEXT(EFFECTIVE_DATE,to_date('1951-01-01 00:00:00'))
l_1000_hrs_reached_date = GET_CONTEXT(EFFECTIVE_DATE,to_date('1951-01-01 00:00:00'))
l_person_id = GET_CONTEXT(PERSON_ID,0)
l_assignment_id = GET_CONTEXT(HR_ASSIGNMENT_ID,0)

l_index = PER_HIST_ASG_ASSIGNMENT_ID.FIRST(-1)

WHILE (PER_HIST_ASG_ASSIGNMENT_ID.EXISTS(l_index) ) LOOP
(
l_asg_id = PER_HIST_ASG_ASSIGNMENT_ID[l_index]
l_hist_assignment_type=PER_HIST_ASG_ASSIGNMENT_TYPE[l_index]
l_hist_asg_start_date=PER_HIST_ASG_EFFECTIVE_START_DATE[l_index]
l_hist_asg_end_date= PER_HIST_ASG_EFFECTIVE_END_DATE[l_index]
l_hist_asg_primary_flag=PER_HIST_ASG_PRIMARY_FLAG[l_index]
l_hist_wr_primary_flag=PER_HIST_ASG_PRIMARY_WORK_REL_FLAG[l_index]
l_hist_asg_status_type= PER_HIST_ASG_USER_PERSON_TYPE[l_index]

IF ( l_asg_id = l_assignment_id AND l_hist_asg_primary_flag = 'Y' AND l_hist_wr_primary_flag = 'Y' AND l_hist_assignment_type = 'E' )
THEN
(
 L_LAST_CHANGE_DATE = l_hist_asg_start_date
 CHANGE_CONTEXTS(EFFECTIVE_DATE = L_LAST_CHANGE_DATE)
 (
  l_1000_hrs_reached = PER_ASG_ATTRIBUTE2
 )

  IF l_1000_hrs_reached = 'Y' THEN
   (
     l_1000_hrs_reached_date = L_LAST_CHANGE_DATE
   )
  ELSE
   (
     l_1000_hrs_reached_date = to_date('1951-01-01 00:00:00')
   )
)        
l_index = PER_HIST_ASG_ASSIGNMENT_ID.NEXT(l_index, -1)
)
RULE_VALUE = TO_CHAR(l_1000_hrs_reached_date)

RETURN RULE_VALUE

1 comment:

  1. Hi, Can you provide the Problem statement, your approach to the problem, the design of the Fastformula, explanation of the Fastformula (line-wise) and the output with screenshots? without these things, it may as well be that we are reading an alien language...

    ReplyDelete