Tuesday, 26 December 2023

UCM Bursting Query BIP

 select to_char(call_id) as KEY,

'RolesRemoval' TEMPLATE,
'en-US' LOCALE,
'TEXT' OUTPUT_FORMAT,
'WCC' DEL_CHANNEL,
'FA_UCM_PROVISIONED' PARAMETER1,  /* Server Name */
'FAFusionImportExport' PARAMETER2,  /* Security Group */
:xdo_user_name PARAMETER3,  /* Author of the File */
'User'||to_char(call_id)||'.txt' PARAMETER5,  /* Title */
'User.dat' PARAMETER6,  /* Output File Name */
:TASK_INSTANCE_ID PARAMETER7,  /* Comments (Optional) */
'User'||to_char(call_id) PARAMETER8,   /* Content ID (Optional) If you specify the ID, it must be unique. If you don't specify the ID, the system generates a unique one. */
'FALSE' PARAMETER9  /* Custom metadata (true/false). Specify ‘false’.*/
from 
(
select r.call_id
from pay_flow_task_instances fti
,pay_flow_tasks_vl ft
,pay_requests r
where ft.flow_task_name = 'Generate Data'
and ft.base_flow_task_id = fti.base_flow_task_id 
and fti.flow_task_instance_id = r.flow_task_instance_id 
and r.call_type= 'ESS'
and  fti.flow_task_instance_id = :TASK_INSTANCE_ID
union
select 1234
from dual
where :TASK_INSTANCE_ID is null
)

Tuesday, 21 November 2023

Query for Date Parameter in the format YYYY/MM

with year as (
select yyyy from (SELECT LEVEL yyyy FROM DUAL CONNECT BY LEVEL <= EXTRACT(YEAR FROM SYSDATE)) where yyyy>=1951
),
month as (
SELECT to_char(LEVEL,'fm00') mm FROM DUAL CONNECT BY LEVEL <= EXTRACT(month FROM SYSDATE)
)
select yyyy||'/'||mm param from year y, month m
order by yyyy desc,mm desc

Tuesday, 12 September 2023

Sample Fast Formula - Global Absence Type Duration Formula

/******************************************************************************

FORMULA NAME: XYZ_Client_LWP_Duration_FF
FORMULA TYPE: Global Absence Type Duration Formula
DESCRIPTION: This formula returns the duration for India Client emps for LWP absence type deducting Republic Day, Independence Day and Gandhi Jayanthi
Change History:
Name Date Version Comments
-------------------------------------------------------------------------------
Aditya  Initial Version
*******************************************************************************/
DEFAULT FOR IV_START_DATE IS '4712/12/31 00:00:00' (date)
DEFAULT FOR IV_END_DATE IS '4712/12/31 00:00:00' (date)
DEFAULT FOR IV_START_TIME IS '00:00'
DEFAULT FOR IV_END_TIME IS '23:59'
DEFAULT FOR PER_ASG_FTE_VALUE IS 1
INPUTS ARE IV_START_DATE (date), IV_END_DATE (date), IV_START_TIME(text),IV_END_TIME(text)
ln_entry_duration_d = 0
ln_subtract_duration = 0
DURATION =0
ld_period_start_date = to_date(to_char(IV_START_DATE,'DD/MM/RRRR')||' '||'00:00:00','DD/MM/RRRR HH24:MI:SS')
ld_period_end_date = to_date(to_char(IV_END_DATE,'DD/MM/RRRR')||' '||'00:00:00','DD/MM/RRRR HH24:MI:SS')

ln_entry_duration_d = days_between(ld_period_end_date,ld_period_start_date) + 1
ln_start_year = to_number(to_char(IV_START_DATE,'RRRR'))
ln_end_year = to_number(to_char(IV_END_DATE,'RRRR'))
while ln_start_year<=ln_end_year loop
(
ld_republic_day = to_date('26/01/'||to_char(ln_start_year)||' '||'00:00:00','DD/MM/RRRR HH24:MI:SS')
ld_independence_day = to_date('15/08/'||to_char(ln_start_year)||' '||'00:00:00','DD/MM/RRRR HH24:MI:SS')
ld_gandhi_jayanthi = to_date('02/10/'||to_char(ln_start_year)||' '||'00:00:00','DD/MM/RRRR HH24:MI:SS')
ln_subtract_duration = ln_subtract_duration + is_date_between(ld_republic_day,ld_period_start_date,ld_period_end_date)
ln_subtract_duration = ln_subtract_duration + is_date_between(ld_independence_day,ld_period_start_date,ld_period_end_date)
ln_subtract_duration = ln_subtract_duration + is_date_between(ld_gandhi_jayanthi,ld_period_start_date,ld_period_end_date)
ln_start_year = ln_start_year + 1
)
ln_entry_duration_d = ln_entry_duration_d - ln_subtract_duration
if ln_entry_duration_d > 0 then
DURATION = ln_entry_duration_d
else
DURATION = 0

RETURN DURATION

Monday, 11 September 2023

Sample Fast Formula - Global Absence Entry Validation

 /**********************************************************************
FORMULA NAME: XYZ_Client_Absence_Entry_Validation_FF
FORMULA TYPE: Global Absence Entry Validation 
DESCRIPTION : Validate Adoption Leave, Miscellaneous Maternity Leave, Maternity Leave, Sabbatical Leave, Optional Holiday, Leave Without Pay
**********************************************************************
Change History:
Name Date Version Comments
-------------------------------------------------------------------------------
Aditya Initial Version
*******************************************************************************/
DEFAULT FOR IV_START_DATE IS '4712/12/31 00:00:00' (date)
DEFAULT FOR IV_END_DATE IS '4712/12/31 00:00:00' (date)
DEFAULT FOR IV_ABSENCE_REASON IS ' '
DEFAULT FOR IV_TOTALDURATION  IS 0
DEFAULT FOR PER_ASG_MANAGER_USER_PERSON_ID  IS -1
DEFAULT_DATA_VALUE for ANC_PER_ABS_ENTRS_ABSENCE_ENTRY_ID_ARR is 0
DEFAULT_DATA_VALUE for PER_EXT_PER_ROLE_NAME is 'XYZ'
DEFAULT FOR PER_PERSON_EIT_EFF_USER_IN_Client_SABBATICAL_SABBATICAL_TAKEN is 'N'
DEFAULT FOR ANC_ABS_ENTRS_ABSENCE_TYPE_ID is 0
DEFAULT FOR ANC_ABS_ENTRS_ABSENCE_STATUS_CD IS ' '
DEFAULT FOR ANC_ABS_TYP_NAME IS ' '
DEFAULT FOR ANC_ABS_ENTRS_END_DATE IS '4712/12/31 00:00:00' (date)
DEFAULT FOR PER_REL_ATTRIBUTE_DATE4 IS '4712/12/31 00:00:00' (date)
DEFAULT FOR PER_PERSON_ENTERPRISE_HIRE_DATE IS '4712/12/31 00:00:00' (date)
DEFAULT FOR PER_PER_LATEST_REHIRE_DATE IS '4712/12/31 00:00:00' (date)
DEFAULT FOR PER_PER_WORK_RELATIONSHIP_MAX_DATE IS '4712/12/31 00:00:00' (date)
DEFAULT FOR GLOBAL_PAY_INTERFACE_EXTRACTION_DATE is '47121231'
DEFAULT FOR STRT_DT IS '4712/12/31 00:00:00' (date)
DEFAULT for LC_ABS_CHECK IS '0'
DEFAULT FOR l_annual_leave_balance is 0
DEFAULT FOR l_annual_leave_carryover_balance is 0
INPUTS ARE IV_END_DATE (date), IV_START_DATE (date), IV_ABSENCE_REASON, IV_TOTALDURATION
lc_absence_reason1 = 'Adopting Child with age less than 3 months'
lc_absence_reason2 = 'Adopting Child with age more than 3 months'
lc_absence_reason3 = 'Miscarriage Leave'
lc_absence_reason4 = 'Tubectomy Operation'
lc_absence_reason5 = 'Leave for illness arising out of maternity complications'
lc_absence_reason6 = 'Medical termination of pregnancy'
lc_absence_reason7 = 'Premature birth of child'
VALID           = 'Y'
lc_absence_type = ANC_ABS_TYP_NAME
lc_absence_reason = IV_ABSENCE_REASON
ln_absence_duration = IV_TOTALDURATION
lc_err = 'Error-'
LD_START_DATE = to_char(IV_START_DATE,'dd-mm-rrrr')

if lc_absence_type = 'Adoption Leave' then
(
if lc_absence_reason = lc_absence_reason1 THEN
(
if ln_absence_duration <> 84 then
(
ERROR_MESSAGE ='XYZ_CUSTOM_ABS_VALIDATION'
TOKEN_NAME[1] = 'MESSAGE'
TOKEN_VALUE[1]= 'Absence Duration has to be 84 Calendar Days'
ERROR_CODE = 'E' 
VALID = 'N'
return VALID,ERROR_MESSAGE,ERROR_CODE,TOKEN_NAME,TOKEN_VALUE 
)
)
if lc_absence_reason = lc_absence_reason2 THEN
(
if ln_absence_duration <> 28 then
(
ERROR_MESSAGE ='XYZ_CUSTOM_ABS_VALIDATION'
TOKEN_NAME[1] = 'MESSAGE'
TOKEN_VALUE[1]= 'Absence Duration has to be 28 Calendar Days'
ERROR_CODE = 'E' 
VALID = 'N'
return VALID,ERROR_MESSAGE,ERROR_CODE,TOKEN_NAME,TOKEN_VALUE 
)
)
)
else if lc_absence_type = 'Miscellaneous Maternity Leave' then
(
if lc_absence_reason = lc_absence_reason3 THEN
(
if ln_absence_duration <> 42 then
(
ERROR_MESSAGE ='XYZ_CUSTOM_ABS_VALIDATION'
TOKEN_NAME[1] = 'MESSAGE'
TOKEN_VALUE[1]= 'Absence Duration has to be 42 Calendar Days '
ERROR_CODE = 'E' 
VALID = 'N'
return VALID,ERROR_MESSAGE,ERROR_CODE,TOKEN_NAME,TOKEN_VALUE 
)
)
if lc_absence_reason = lc_absence_reason4 THEN
(
if ln_absence_duration <> 14 then
(
ERROR_MESSAGE ='XYZ_CUSTOM_ABS_VALIDATION'
TOKEN_NAME[1] = 'MESSAGE'
TOKEN_VALUE[1]= 'Absence Duration has to be 14 Calendar Days'
ERROR_CODE = 'E' 
VALID = 'N'
return VALID,ERROR_MESSAGE,ERROR_CODE,TOKEN_NAME,TOKEN_VALUE 
)
)
if lc_absence_reason = lc_absence_reason5 or lc_absence_reason = lc_absence_reason6 or lc_absence_reason = lc_absence_reason7 THEN
(
if ln_absence_duration <> 28 then
(
ERROR_MESSAGE ='XYZ_CUSTOM_ABS_VALIDATION'
TOKEN_NAME[1] = 'MESSAGE'
TOKEN_VALUE[1]= 'Absence Duration has to be 28 Calendar Days'
ERROR_CODE = 'E' 
VALID = 'N'
return VALID,ERROR_MESSAGE,ERROR_CODE,TOKEN_NAME,TOKEN_VALUE 
)
)
)
else if lc_absence_type = 'Maternity Leave' then
(
if PER_REL_ATTRIBUTE_DATE4 was defaulted THEN
(
/*STRT_DT = PER_PERSON_ENTERPRISE_HIRE_DATE*/
/*STRT_DT = PER_PER_LATEST_REHIRE_DATE*/
/*STRT_DT = PER_PER_WORK_RELATIONSHIP_MAX_DATE*/
STRT_DT = PER_PER_LATEST_REHIRE_DATE
)
ELSE
(
STRT_DT = PER_REL_ATTRIBUTE_DATE4
)
ln_days = DAYS_BETWEEN(IV_START_DATE,STRT_DT)
if ln_days < 80 then
(
ERROR_MESSAGE ='XYZ_CUSTOM_ABS_VALIDATION'
TOKEN_NAME[1] = 'MESSAGE'
TOKEN_VALUE[1]= 'Employment is less than 80 calendar days, so cannot avail Maternity Leave'
ERROR_CODE = 'E' 
VALID = 'N'
return VALID,ERROR_MESSAGE,ERROR_CODE,TOKEN_NAME,TOKEN_VALUE 
)
l_person_id = TO_CHAR(GET_CONTEXT(PERSON_ID,0))
L_SESSION_USER_PERSONID = GET_VALUE_SET('XYZ_SESSION_USER_PERSONID_VS')
LN_CHILD_COUNT = to_number(GET_VALUE_SET('XYZ_IN_CHILD_COUNT_VS','|=EMP_PERSON_ID='''||l_person_id||''''))
/*if ln_absence_duration <> 182 and L_SESSION_USER_PERSONID = l_person_id and LN_CHILD_COUNT <=1 and L_SESSION_USER_PERSONID<>to_char(PER_ASG_MANAGER_USER_PERSON_ID) then*/
if ln_absence_duration <> 182 and (L_SESSION_USER_PERSONID = l_person_id or L_SESSION_USER_PERSONID = to_char(PER_ASG_MANAGER_USER_PERSON_ID)) and LN_CHILD_COUNT <=1 then
(
ERROR_MESSAGE ='XYZ_CUSTOM_ABS_VALIDATION'
TOKEN_NAME[1] = 'MESSAGE'
TOKEN_VALUE[1]= 'Absence Duration should be equal to 26 weeks or 182 calendar days. Based on the start date provided, end date should be '|| to_char(add_days(IV_START_DATE,181),'dd-mon-rrrr')
ERROR_CODE = 'E' 
VALID = 'N'
return VALID,ERROR_MESSAGE,ERROR_CODE,TOKEN_NAME,TOKEN_VALUE 
)
else if ln_absence_duration <> 84 and (L_SESSION_USER_PERSONID = l_person_id or L_SESSION_USER_PERSONID = to_char(PER_ASG_MANAGER_USER_PERSON_ID)) and LN_CHILD_COUNT >= 2 then
(
ERROR_MESSAGE ='XYZ_CUSTOM_ABS_VALIDATION'
TOKEN_NAME[1] = 'MESSAGE'
TOKEN_VALUE[1]= 'Absence Duration should be equal to 12 weeks or 84 calendar days. Based on the start date provided, end date should be '|| to_char(add_days(IV_START_DATE,83),'dd-mon-rrrr')
ERROR_CODE = 'E' 
VALID = 'N'
return VALID,ERROR_MESSAGE,ERROR_CODE,TOKEN_NAME,TOKEN_VALUE 
)
lc_hr_assignment_id = TO_CHAR(GET_CONTEXT(HR_ASSIGNMENT_ID,0))
lc_ABSENCE_ENTRY_ID = TO_CHAR(GET_CONTEXT(ABSENCE_ENTRY_ID,-1))
LN_PREV_ABS_GAP = to_number(GET_VALUE_SET('XYZ_IN_MONTHS_BETWEEN_ABS_VS','|=ASG_ID='''||lc_hr_assignment_id||'''|ABS_NAME='''||lc_absence_type||'''|ABS_START_DATE='''||LD_START_DATE||'''|ABS_ENTRY_ID='''||lc_ABSENCE_ENTRY_ID||''''))
if LN_PREV_ABS_GAP < 7 THEN (
ERROR_MESSAGE ='XYZ_CUSTOM_ABS_VALIDATION'
TOKEN_NAME[1] = 'MESSAGE'
/*TOKEN_VALUE[1]= 'Absence cannot be applied as previous absence ended less than 7 months back'||LD_START_DATE||lc_absence_type||'-'||lc_hr_assignment_id||'-'||lc_ABSENCE_ENTRY_ID||'-'||to_char(LN_PREV_ABS_GAP)*/
TOKEN_VALUE[1]= 'Absence cannot be applied as previous absence ended less than 7 months back'
ERROR_CODE = 'E' 
VALID = 'N'
return VALID,ERROR_MESSAGE,ERROR_CODE,TOKEN_NAME,TOKEN_VALUE 
)
)
else if lc_absence_type = 'Sabbatical Leave' then
(
if PER_PERSON_EIT_EFF_USER_IN_Client_SABBATICAL_SABBATICAL_TAKEN = 'Y' then
(
ERROR_MESSAGE ='XYZ_CUSTOM_ABS_VALIDATION'
TOKEN_NAME[1] = 'MESSAGE'
TOKEN_VALUE[1]= 'Sabbatical Leave has already been availed'
ERROR_CODE = 'E' 
VALID = 'N'
return VALID,ERROR_MESSAGE,ERROR_CODE,TOKEN_NAME,TOKEN_VALUE 
)
l_curr_date = TO_DATE(GLOBAL_PAY_INTERFACE_EXTRACTION_DATE)
if days_between(IV_START_DATE,l_curr_date) < 30 then
(
ERROR_MESSAGE ='XYZ_CUSTOM_ABS_VALIDATION'
TOKEN_NAME[1] = 'MESSAGE'
TOKEN_VALUE[1]= 'Sabbatical Leave can be availed with atleast 30 days notice'
ERROR_CODE = 'E' 
VALID = 'N'
return VALID,ERROR_MESSAGE,ERROR_CODE,TOKEN_NAME,TOKEN_VALUE 
)
if PER_REL_ATTRIBUTE_DATE4 was defaulted THEN
(
/*STRT_DT = PER_PERSON_ENTERPRISE_HIRE_DATE*/
/*STRT_DT = PER_PER_LATEST_REHIRE_DATE*/
/*STRT_DT = PER_PER_WORK_RELATIONSHIP_MAX_DATE*/
STRT_DT = PER_PER_LATEST_REHIRE_DATE
)
ELSE
(
STRT_DT = PER_REL_ATTRIBUTE_DATE4
)
if months_between(IV_START_DATE,STRT_DT) < 36 then
(
ERROR_MESSAGE ='XYZ_CUSTOM_ABS_VALIDATION'
TOKEN_NAME[1] = 'MESSAGE'
TOKEN_VALUE[1]= 'Employee has not spent minimum tenure in the organization'
ERROR_CODE = 'E' 
VALID = 'N'
return VALID,ERROR_MESSAGE,ERROR_CODE,TOKEN_NAME,TOKEN_VALUE 
)
)
else if lc_absence_type = 'Optional Holiday' then
(
LC_ABS_CHECK = GET_VALUE_SET('XYZ_IN_CAL_EVENT_VALUE_SET','|=ABS_START_DATE='''||LD_START_DATE||'''')
if LC_ABS_CHECK = '0' THEN
(
ERROR_MESSAGE ='XYZ_CUSTOM_ABS_VALIDATION'
TOKEN_NAME[1] = 'MESSAGE'
TOKEN_VALUE[1]= 'No Optional Holiday available on the selected date'
ERROR_CODE = 'E' 
VALID = 'N'
return VALID,ERROR_MESSAGE,ERROR_CODE,TOKEN_NAME,TOKEN_VALUE  
)
)
else if lc_absence_type = 'Leave Without Pay' then
(
ln_hr_assignment_id = GET_CONTEXT(HR_ASSIGNMENT_ID,0)
ld_effective_date= to_date(to_char(IV_START_DATE,'RRRR')||'/12/31','rrrr/mm/dd')
ln_leg_group_id = GET_CONTEXT(LEGISLATIVE_DATA_GROUP_ID,0)
LN_PERSON_ID = GET_CONTEXT(PERSON_ID,-1)
CHANGE_CONTEXTS(HR_ASSIGNMENT_ID = ln_hr_assignment_id,PERSON_ID = LN_PERSON_ID,EFFECTIVE_DATE = ld_effective_date,LEGISLATIVE_DATA_GROUP_ID = ln_leg_group_id)
(
lc_plan_name = 'Annual Leave'
l_annual_leave_balance = GET_PLAN_BALANCE(lc_plan_name)
lc_plan_name = 'Annual Leave - Carry Over'
l_annual_leave_carryover_balance  = GET_PLAN_BALANCE(lc_plan_name)
)
if l_annual_leave_balance + l_annual_leave_carryover_balance > 0 THEN
(
ERROR_MESSAGE ='XYZ_CUSTOM_ABS_VALIDATION'
TOKEN_NAME[1] = 'MESSAGE'
TOKEN_VALUE[1]= 'Absence cannot be applied as Annual Leave is not exhausted'
ERROR_CODE = 'E' 
VALID = 'N'
return VALID,ERROR_MESSAGE,ERROR_CODE,TOKEN_NAME,TOKEN_VALUE  
)
)
else if lc_absence_type = 'Annual Leave' then
(
ln_hr_assignment_id = GET_CONTEXT(HR_ASSIGNMENT_ID,0)
ld_effective_date= to_date(to_char(IV_START_DATE,'RRRR')||'/12/31','rrrr/mm/dd')
ln_leg_group_id = GET_CONTEXT(LEGISLATIVE_DATA_GROUP_ID,0)
LN_PERSON_ID = GET_CONTEXT(PERSON_ID,-1)
CHANGE_CONTEXTS(HR_ASSIGNMENT_ID = ln_hr_assignment_id,PERSON_ID = LN_PERSON_ID,EFFECTIVE_DATE = ld_effective_date,LEGISLATIVE_DATA_GROUP_ID = ln_leg_group_id)
(
lc_plan_name = 'Annual Leave'
l_annual_leave_balance = GET_PLAN_BALANCE(lc_plan_name)
lc_plan_name = 'Annual Leave - Carry Over'
l_annual_leave_carryover_balance  = GET_PLAN_BALANCE(lc_plan_name)
)
if l_annual_leave_balance + l_annual_leave_carryover_balance < IV_TOTALDURATION THEN
(
ERROR_MESSAGE ='XYZ_CUSTOM_ABS_VALIDATION'
TOKEN_NAME[1] = 'MESSAGE'
TOKEN_VALUE[1]= 'Absence duration is more than the Annual Leave Balance available'
ERROR_CODE = 'E' 
VALID = 'N'
return VALID,ERROR_MESSAGE,ERROR_CODE,TOKEN_NAME,TOKEN_VALUE  
)
)
else if lc_absence_type = 'Paternity Leave' then
(
lc_hr_assignment_id = TO_CHAR(GET_CONTEXT(HR_ASSIGNMENT_ID,0))
lc_ABSENCE_ENTRY_ID = TO_CHAR(GET_CONTEXT(ABSENCE_ENTRY_ID,-1))
LN_PREV_ABS_GAP = to_number(GET_VALUE_SET('XYZ_IN_MONTHS_BETWEEN_ABS_VS','|=ASG_ID='''||lc_hr_assignment_id||'''|ABS_NAME='''||lc_absence_type||'''|ABS_START_DATE='''||LD_START_DATE||'''|ABS_ENTRY_ID='''||lc_ABSENCE_ENTRY_ID||''''))
if LN_PREV_ABS_GAP < 7 THEN (
ERROR_MESSAGE ='XYZ_CUSTOM_ABS_VALIDATION'
TOKEN_NAME[1] = 'MESSAGE'
/*TOKEN_VALUE[1]= 'Absence cannot be applied as previous absence ended less than 7 months back'||LD_START_DATE||lc_absence_type||'-'||lc_hr_assignment_id||'-'||lc_ABSENCE_ENTRY_ID||'-'||to_char(LN_PREV_ABS_GAP)*/
TOKEN_VALUE[1]= 'Absence cannot be applied as previous absence ended less than 7 months back'
ERROR_CODE = 'E' 
VALID = 'N'
return VALID,ERROR_MESSAGE,ERROR_CODE,TOKEN_NAME,TOKEN_VALUE 
)
)
return VALID

Sample Fast Formula - Global Absence Rollover

 /***************************************************************************

FORMULA NAME: XYZ_Annual_Leave_Rollover_FF

FORMULA TYPE: Global Absence Rollover

DESCRIPTION: This is used to calculate the Annual Leave Rollover value to the 'Annual Leave - Carry Over' plan at the end of every year for Edelweiss India emps

Change History:

Name Date Version Comments

-------------------------------------------------------------------------------

Aditya Initial Version

*******************************************************************************/

DEFAULT FOR PER_ASG_BUSINESS_UNIT_NAME IS ' '

DEFAULT FOR l_plan_balance is 0

DEFAULT FOR l_rollover is 0


INPUTS ARE IV_ACCRUAL, 

IV_CARRYOVER,

IV_ACCRUALPERIODSTARTDATE (date), 

IV_ACCRUALPERIODENDDATE (date), 

IV_CALEDARSTARTDATE (date), 

IV_CALEDARENDDATE (date), 

IV_PLANENROLLMENTSTARTDATE (date), 

IV_PLANENROLLMENTENDDATE (date)



lc_plan_name = 'Annual Leave - Carry Over'

ln_hr_assignment_id = GET_CONTEXT(HR_ASSIGNMENT_ID,0)

ld_effective_date= GET_CONTEXT(EFFECTIVE_DATE,'4712/12/31 00:00:00'(date))

ln_leg_group_id = GET_CONTEXT(LEGISLATIVE_DATA_GROUP_ID,0)

LN_PERSON_ID = GET_CONTEXT(PERSON_ID,-1)



L_DATA = ESS_LOG_WRITE('XYZ_Annual_Leave_Rollover_FF: Value of ln_hr_assignment_id: ' || to_char(ln_hr_assignment_id))


L_DATA = ESS_LOG_WRITE('XYZ_Annual_Leave_Rollover_FF: Value of LN_PERSON_ID: ' || to_char(LN_PERSON_ID))


L_DATA = ESS_LOG_WRITE('XYZ_Annual_Leave_Rollover_FF: Value of ld_effective_date: ' || to_char(ld_effective_date))

L_DATA = ESS_LOG_WRITE('XYZ_Annual_Leave_Rollover_FF: Value of ln_leg_group_id: ' || to_char(ln_leg_group_id))



CHANGE_CONTEXTS(HR_ASSIGNMENT_ID = ln_hr_assignment_id,PERSON_ID = LN_PERSON_ID,EFFECTIVE_DATE = ld_effective_date,LEGISLATIVE_DATA_GROUP_ID = ln_leg_group_id)


(


l_plan_balance = GET_PLAN_BALANCE(lc_plan_name)


)


MAX_CARRYOVER = 60

l_rollover = MAX_CARRYOVER-l_plan_balance

L_DATA = ESS_LOG_WRITE('XYZ_Annual_Leave_Rollover_FF: Value of l_plan_balance: ' || to_char(l_plan_balance))

L_DATA = ESS_LOG_WRITE('XYZ_Annual_Leave_Rollover_FF: Value of l_rollover: ' || to_char(l_rollover))


MAX_ROLLOVER = 10

if l_rollover > MAX_ROLLOVER

THEN

(

ROLLOVER = MAX_ROLLOVER

)

ELSE 

(

ROLLOVER = l_rollover

)


L_DATA = ESS_LOG_WRITE('XYZ_Annual_Leave_Rollover_FF: Value of ROLLOVER: ' || to_char(ROLLOVER))


RETURN ROLLOVER


x

Saturday, 2 September 2023

Wednesday, 26 July 2023

Decimal Formatting in EText

 Number,#.00 will give data in the format 12345.67 but 0 will be displayed as .00 and 1500 will be displayed as 1500.00 and 1500.66 will be displayed as 1500.66

 Number,#.## will also give data in the format 12345.67, 0 will be displayed as 0 and 1500 will be displayed as 1500 and 1500.66 will be displayed as 1500.66




Wednesday, 21 June 2023

Element Entries Query in Oracle HCM

SELECT  papf.person_number "PersonNumber"
        ,to_char(pee.effective_start_date,'YYYY/MM/DD') "ElementEntryEffectiveStartDate"
        ,to_char(pee.effective_end_date,'YYYY/MM/DD') "ElementEntryEffectiveEndtDate"
        ,petl.element_name "ElementName"
        ,pldgt.name "LegislativeDataGroupName"
        ,pldg.legislation_code "LegislationCode"
        ,piv.base_name "InputValueName"
        ,peev.screen_entry_value "ScreenEntryValue"
        ,to_char(peev.EFFECTIVE_START_DATE,'YYYY/MM/DD') "EntryValueStartDate"
        ,to_char(peev.EFFECTIVE_END_DATE,'YYYY/MM/DD') "EntryValueEndDate"
   FROM pay_element_entries_f pee,
        pay_element_types_f pet,
        pay_element_types_tl petl,
        pay_entry_usages peu,
        pay_payroll_assignments ppa,
        per_all_assignments_f paaf,
        per_periods_of_service ppos,
        per_all_people_f papf,
        per_legislative_data_groups pldg,
        per_legislative_data_groups_tl pldgt,
        pay_element_entry_values_f peev,
        pay_input_values_f piv
  WHERE ppos.date_start=(SELECT MAX(ppos1.date_start)
                           FROM per_periods_of_service  ppos1
                          WHERE ppos1.person_id=ppos.person_id
                            )
    AND ppos.period_of_service_id = paaf.period_of_service_id
    AND paaf.person_id = papf.person_id       
    AND paaf.assignment_type IN ('E')
    AND paaf.primary_flag = 'Y'   
    AND pee.element_type_id = pet.element_type_id
    AND pet.element_type_id = petl.element_type_id
    AND pee.element_entry_id = peu.element_entry_id
    AND peu.payroll_relationship_id=ppa.payroll_relationship_id
    AND ppa.hr_assignment_id = paaf.assignment_id
    AND paaf.legislation_code = pldg.legislation_code
    AND pldg.legislative_data_group_id = pldgt.legislative_data_group_id
    AND pee.element_entry_id = peev.element_entry_id
    AND peev.input_value_id = piv.input_value_id
    AND pet.element_type_id = piv.element_type_id
    AND pldgt.language = 'US'
    AND trunc(sysdate) BETWEEN paaf.effective_start_date AND paaf.effective_end_date
    AND trunc(sysdate) BETWEEN papf.effective_start_date AND papf.effective_end_date
AND trunc(sysdate) BETWEEN peev.effective_start_date AND peev.effective_end_date
AND trunc(sysdate) BETWEEN pee.effective_start_date AND pee.effective_end_date
    AND petl.language = 'US'
    AND petl.element_name = 'ElementName'
and piv.base_name  = 'InputValue'
    AND papf.person_number in 
(
'12345'
)
order by papf.person_number

Tuesday, 20 June 2023

Monday, 19 June 2023

Pull Data from another attribute in Extract into a Fast formula

 /*******************************************************************
FORMULA NAME : GET_WORK_EMAIL_FF
FORMULA TYPE : Extract Rule
 DESCRIPTION : Get value set value for Email
Change History:
Name                   Date         Comments
--------------------------------------------------------------------------------------------------------------------------

*******************************************************************
*/
DEFAULT FOR DATA_ELEMENTS IS EMPTY_TEXT_TEXT
INPUTS ARE DATA_ELEMENTS (TEXT_TEXT)
l_per_id = ' '
/* To retrieve 'Data element' from attribute */
 
IF (DATA_ELEMENTS.EXISTS('Person_ID') ) THEN
(
   l_per_id = DATA_ELEMENTS['Person_ID'] 
    
   rule_value = GET_VALUE_SET('GET_WORK_EMAIL_VS','|=P_PERSON_ID='''||l_per_id||'''')
   
)

RETURN rule_value

Thursday, 8 June 2023

Query to fetch Checklist or Journey related Questionnaire responses

 select responsibility_type,question_text,answer,full_name
from
(
select task.responsibility_type,question_text,nvl2(resp.ANSWER_CODE,resp.LONG_TEXT,resp.ANSWER_CLOB) answer,ppnf.full_name
from Per_allocated_tasks task,
per_allocated_checklists pac,
HRQ_QSTNR_PCPT_RESPONSES_V resp,
HRQ_QUESTIONS_VL ques,
per_person_names_f ppnf
where 1=1
and task.allocated_checklist_id = pac.allocated_checklist_id
and task.questionnaire_id = resp.questionnaire_id
and task.action_type = 'ORA_CHK_QUESTIONNAIRE'
and resp.question_code = ques.question_code
and pac.person_id = ppnf.person_id
and ppnf.name_type = 'GLOBAL'
and task.allocated_task_id = resp.participant_id
and trunc(sysdate) between ppnf.effective_start_date and ppnf.effective_end_date
and task.allocated_checklist_id = :P_ALLOCATED_CHECKLIST_ID
)
order by responsibility_type,question_text

Friday, 26 May 2023

External bank accounts and owners tables

select * from IBY_EXT_BANK_ACCOUNTS where 1=1 order by creation_date desc

select * from IBY_ACCOUNT_OWNERS where 1=1 order by creation_date desc


Thursday, 25 May 2023

How to Load Hire/Termination/Rehire Historical Data with HDL?

 METADATA|Worker|SourceSystemOwner|SourceSystemId|PersonId|ActionCode|ReasonCode|EffectiveStartDate|EffectiveEndDate|PersonNumber|StartDate|DateOfBirth|CountryOfBirth|WaiveDataProtectFlag

MERGE|Worker|HRC_SQLLOADER|40001023PER15||HIRE||1990/07/16|4712/12/31|40001023PER15|1990/07/16|1943/07/12|EE|N

METADATA|PersonLegislativeData|SourceSystemOwner|SourceSystemId|EffectiveStartDate|EffectiveEndDate|PersonId(SourceSystemId)|LegislationCode|MaritalStatus|Sex

MERGE|PersonLegislativeData|HRC_SQLLOADER|40001023PER15|1990/07/16|4712/12/31|40001023PER15|US||F

METADATA|PersonName|SourceSystemOwner|SourceSystemId|EffectiveStartDate|EffectiveEndDate|PersonId(SourceSystemId)|LegislationCode|NameType|FirstName|MiddleNames|LastName|Honors|KnownAs|Title|NameInformation15|NameInformation16

MERGE|PersonName|HRC_SQLLOADER|40001023PER15|1990/07/16|2005/05/03|40001023PER15|US|GLOBAL|WorkerTest01|WorkerTest01|WorkerTest01|||MS.||

MERGE|PersonName|HRC_SQLLOADER|40001023PER15|2005/05/04|4712/12/31|40001023PER15|US|GLOBAL|WorkerTest01|WorkerTest01|WorkerTest01||WorkerTest01|MS.|WorkerTest01|

METADATA|WorkRelationship|SourceSystemOwner|SourceSystemId|LegalEmployerName|PersonId(SourceSystemId)|DateStart|WorkerType|LegalEmployerSeniorityDate|ActualTerminationDate|EnterpriseSeniorityDate|LastWorkingDate|NotifiedTerminationDate|OnMilitaryServiceFlag|PrimaryFlag|ActionCode|ReasonCode

MERGE|WorkRelationship|HRC_SQLLOADER|WR-40001023PER15|GBI HCM Widgets USA|40001023PER15|1990/07/16|E||2000/12/31|1990/07/16|||N|Y|RESIGNATION|RESIGN_PERSONAL

MERGE|WorkRelationship|HRC_SQLLOADER|WR-40001023PER1501|GBI_GHR_2TMA|40001023PER15|2001/01/01|E||2005/12/31|1990/07/16|||N|Y|RESIGNATION|RESIGN_PERSONAL

MERGE|WorkRelationship|HRC_SQLLOADER|WR-40001023PER1502|GBI_GHR_2TSA|40001023PER15|2006/01/01|E|||1990/07/16|||N|Y|HIRE|

METADATA|WorkTerms|SourceSystemOwner|SourceSystemId|ActionCode|ReasonCode|LegalEmployerName|AssignmentNumber|AssignmentName|EffectiveStartDate|EffectiveEndDate|EffectiveLatestChange|EffectiveSequence|PeriodOfServiceId(SourceSystemId)|PersonTypeCode|AssignmentStatusTypeCode|AssignmentType|BusinessUnitId|NoticePeriod|PrimaryWorkTermsFlag|FreezeStartDate|FreezeUntilDate

MERGE|WorkTerms|HRC_SQLLOADER|WT-40001023PER15|HIRE||GBI HCM Widgets USA|WT-NU-40001023PER15|WT-NA-40001023PER15|1990/07/16|2000/12/31|N|1|WR-40001023PER15|Employee|ACTIVE_NO_PROCESS|ET|100010025072009|0|Y|4712/12/31|1950/01/01

MERGE|WorkTerms|HRC_SQLLOADER|WT-40001023PER15|RESIGNATION|RESIGN_PERSONAL|GBI HCM Widgets USA|WT-NU-40001023PER15|WT-NA-40001023PER15|2001/01/01|4712/12/31|N|1|WR-40001023PER15|Employee|INACTIVE_NO_PROCESS|ET|100010025072009|0|Y|4712/12/31|1950/01/01

MERGE|WorkTerms|HRC_SQLLOADER|WT-40001023PER1501|HIRE||GBI_GHR_2TMA|WT-NU-40001023PER1501|WT-NA-40001023PER1501|2001/01/01|2005/12/31|N|1|WR-40001023PER1501|Employee|ACTIVE_NO_PROCESS|ET|100010025072009|0|Y|4712/12/31|1950/01/01

MERGE|WorkTerms|HRC_SQLLOADER|WT-40001023PER1501|RESIGNATION|RESIGN_PERSONAL|GBI_GHR_2TMA|WT-NU-40001023PER1501|WT-NA-40001023PER1501|2006/01/01|4712/12/31|N|1|WR-40001023PER1501|Employee|INACTIVE_NO_PROCESS|ET|100010025072009|0|Y|4712/12/31|1950/01/01

MERGE|WorkTerms|HRC_SQLLOADER|WT-40001023PER1502|HIRE||GBI_GHR_2TSA|WT-NU-40001023PER1502|WT-NA-40001023PER1502|2006/01/01|2009/12/31|N|1|WR-40001023PER1502|Employee|ACTIVE_NO_PROCESS|ET|100010025072009|0|Y|4712/12/31|1950/01/01

MERGE|WorkTerms|HRC_SQLLOADER|WT-40001023PER1502|ASG_CHANGE||GBI_GHR_2TSA|WT-NU-40001023PER1502|WT-NA-40001023PER1502|2010/01/01|4712/12/31|N|1|WR-40001023PER1502|Employee|ACTIVE_NO_PROCESS|ET|100010025072009|0|Y|4712/12/31|1950/01/01

METADATA|Assignment|SourceSystemOwner|SourceSystemId|ActionCode|ReasonCode|LegalEmployerName|AssignmentNumber|AssignmentName|EffectiveStartDate|EffectiveEndDate|EffectiveLatestChange|EffectiveSequence|PeriodOfServiceId(SourceSystemId)|WorkTermsAssignmentId(SourceSystemId)|PersonTypeCode|AssignmentStatusTypeCode|AssignmentType|BusinessUnitId|NoticePeriod|PrimaryAssignmentFlag|FreezeStartDate|FreezeUntilDate

MERGE|Assignment|HRC_SQLLOADER|WA-40001023PER15|HIRE||GBI HCM Widgets USA|WA-NU-40001023PER15|WA-NA-40001023PER15|1990/07/16|2000/12/31|N|1|WR-40001023PER15|WT-40001023PER15|Employee|ACTIVE_NO_PROCESS|E|100010025072009|0|Y|4712/12/31|1950/01/01

MERGE|Assignment|HRC_SQLLOADER|WA-40001023PER15|RESIGNATION|RESIGN_PERSONAL|GBI HCM Widgets USA|WA-NU-40001023PER15|WA-NA-40001023PER15|2001/01/01|4712/12/31|N|1|WR-40001023PER15|WT-40001023PER15|Employee|INACTIVE_NO_PROCESS|E|100010025072009|0|Y|4712/12/31|1950/01/01

MERGE|Assignment|HRC_SQLLOADER|WA-40001023PER1501|HIRE||GBI_GHR_2TMA|WA-NU-40001023PER1501|WA-NA-40001023PER1501|2001/01/01|2005/12/31|N|1|WR-40001023PER1501|WT-40001023PER1501|Employee|ACTIVE_NO_PROCESS|E|100010025072009|0|Y|4712/12/31|1950/01/01

MERGE|Assignment|HRC_SQLLOADER|WA-40001023PER1501|RESIGNATION|RESIGN_PERSONAL|GBI_GHR_2TMA|WA-NU-40001023PER1501|WA-NA-40001023PER1501|2006/01/01|4712/12/31|N|1|WR-40001023PER1501|WT-40001023PER1501|Employee|INACTIVE_NO_PROCESS|E|100010025072009|0|Y|4712/12/31|1950/01/01

MERGE|Assignment|HRC_SQLLOADER|WA-40001023PER1502|HIRE||GBI_GHR_2TSA|WA-NU-40001023PER1502|WA-NA-40001023PER1502|2006/01/01|2009/12/31|N|1|WR-40001023PER1502|WT-40001023PER1502|Employee|ACTIVE_NO_PROCESS|E|100010025072009|0|Y|4712/12/31|1950/01/01

MERGE|Assignment|HRC_SQLLOADER|WA-40001023PER1502|ASG_CHANGE||GBI_GHR_2TSA|WA-NU-40001023PER1502|WA-NA-40001023PER1502|2010/01/01|4712/12/31|N|1|WR-40001023PER1502|WT-40001023PER1502|Employee|ACTIVE_NO_PROCESS|E|100010025072009|0|Y|4712/12/31|1950/01/01

Friday, 5 May 2023

When to use Publish Required in Document of Records setup?

Oracle has explained this clearly in one of the 2018 release updates with an example.


Publish RequiredYou can make a document record visible on the UI from a specific date. The Publish Date field is now configured to be entered using HDL only, and not from the UI. If you want the document to be visible only after a specific date, you must select Yes or No in the Publish Required field on the Create Document Type page. For example, if you want to make the promotion letter visible starting 1-Apr-2018, select Yes on the Create Document Type page. Then, pass the date of 1-Apr-2018 in the Publish Date field using HDL, when creating document records for the worker.

Delete Allocated Checklist HDL sample

METADATA|AllocateChecklist|ChecklistName|ChecklistCategory|ChecklistInstance|PersonNumber
DELETE|AllocateChecklist|Data Handler Acknowledgement|ONBOARD|1|10001
DELETE|AllocateChecklist|Data Handler Acknowledgement|ONBOARD|1|10002

All the tasks will also be deleted automatically.

If you want to delete just a particular task that is also possible through HDL

Thursday, 4 May 2023

Alerts Example - Send Consolidated Email to Manager

Create a resource alert from Tools - Alerts Composer

Resource - workers

 


Add Filter

Resource - workers

Expression -

exists ( Select 'x' from per_all_people_f p where p.person_id =${PersonId} and p.person_number in ('1001','1002','1003'))


Click Apply


Add Template


Click on Manage Recipients and Messages

Give the below in Communication Method as Mail, Expression as ${AlertUtils.toString(AlertUtils.empManagerList(workers.PersonId).WorkEmail)}

Group by - ${AlertUtils.toString(AlertUtils.empManagerList(workers.PersonId).WorkEmail)}

Add below text as message Text

This is a test email. The email is being sent to managers of below person numbers.

${AlertUtils.write("<table border=\"1\"> <tbody><tr><th>Person Number</th> <th>Person Name</th>")}
${AlertUtils.loop('workers','<tr><td>${workers.PersonNumber}<br></td><td>${workers.names.DisplayName}</td></tr>')}
${AlertUtils.write("</tbody></table>")}

Click Apply

Click Save and Close


Now run and test the alert.



Thursday, 27 April 2023

REST api checklists

Invoke POST method to allocate checklist : hcmRestApi/resources/11.13.18.05/allocatedChecklists/action/allocateChecklist

Use Header Key Content-type = application/vnd.oracle.adf.action+json

Request payload
{
  "checklistName" : "Employee Agreement",
  "checklistCategory" : "ONBOARD",
  "personNumber" : "12345",
  "allocationDate" : "2023-01-01"
}

Alert notifications

If worklist is selected - both to email and notification in application are sent

in case of mail is selected - only email is sent, irrespective of setup in BPM to send to none/All/email/in-app. Note that the expression should be different from ${RecipientUserName} and should pull the work/home email

Tuesday, 25 April 2023

Absence query to get absences in previous month(absence will be split if spread across 2 months)

 select * from 
(
select 
papf.person_number,
ppnf.Full_name,
aatft.NAME AbsenceTypeName,
apae.PER_ABSENCE_ENTRY_ID, 
(extract(month from pl_ent.start_date))||'-'||(extract(year from pl_ent.start_date)) MON_YYYY,
min(pl_ent.start_date) start_date,
max(pl_ent.end_date) end_date,
sum(ABS_UNITS) duration
--pl_ent.assignment_id,
--(extract(month from pl_ent.start_date))||'-'||(extract(year from pl_ent.start_date)) MON_YYYY
from 
PER_ALL_PEOPLE_F papf ,
PER_ALL_ASSIGNMENTS_f paam,
PER_PERSON_NAMES_F ppnf ,
ANC_PER_ABS_ENTRIES apae,
ANC_ABSENCE_TYPES_VL aatft,
--ANC_ABSENCE_TYPES_F aatf,
ANC_PER_ABS_PLN_SUMM_ENT summ,
ANC_PER_ABS_PLAN_ENTRIES pl_ent
where 1=1
and papf.person_id = paam.person_id
and papf.person_id = ppnf.person_id
AND paam.person_id = apae.person_id
and apae.absence_type_id = aatft.absence_type_id
and apae.absence_type_id = aatft.absence_type_id
and apae.PER_ABSENCE_ENTRY_ID = summ.PER_ABSENCE_ENTRY_ID
and summ.PER_ABS_PLN_SUMM_ENTRY_ID =  pl_ent.PER_ABS_PLN_SUMM_ENTRY_ID
and paam.assignment_id = pl_ent.assignment_id
and paam.assignment_type='E' 
and paam.effective_latest_change='Y' 
and ppnf.name_type='GLOBAL'
and trunc(sysdate) between papf.effective_start_date and papf.effective_end_date
and trunc(sysdate) between paam.effective_start_date and paam.effective_end_date
and trunc(sysdate) between ppnf.effective_start_date and ppnf.effective_end_date
and trunc(sysdate) between aatft.effective_start_date and aatft.effective_end_date
--and paam.legal_entity_id = 300000115626584
--and aatft.absence_type_id IN(300000120663723,300000001955092) 
/*and (
(to_number(extract(year from sysdate)) = to_number(extract(year from apae.start_date)) 
and to_number(extract(month from sysdate)-1) = to_number(extract(month from apae.start_date)) 
and to_number(extract(day from apae.start_date)) between 01 and 31 )
OR 
(to_number(extract(year from sysdate)) = to_number(extract(year from apae.end_date)) 
and to_number(extract(month from sysdate)-1) = to_number(extract(month from apae.end_date))
and to_number(extract(day from apae.end_date)) between 01 and 31  )
)*/
and papf.person_number='5105196'
--order by papf.person_number,pl_ent.start_date
group by papf.person_number,ppnf.FULL_NAME,aatft.NAME,apae.PER_ABSENCE_ENTRY_ID,(extract(month from pl_ent.start_date))||'-'||(extract(year from pl_ent.start_date))
)
WHERE 1=1
---add more conditions here
and trunc(start_date, 'mm') = trunc(add_months(sysdate,-1), 'mm') 
order by PERSON_NUMBER,start_date

Wednesday, 12 April 2023

Element Entry HDL

METADATA|ElementEntry|EffectiveStartDate|EffectiveEndDate|ElementName|LegislativeDataGroupName|EntryType|AssignmentNumber|MultipleEntryCount

MERGE|ElementEntry|2023/04/01||Assured Bonus|IN Legislative Data Group|E|E5105196-2|1
MERGE|ElementEntry|2023/04/01||Leave Encashment Days|IN Legislative Data Group|E|E5105196-2|1
MERGE|ElementEntry|2023/04/01||ESPP|IN Legislative Data Group|E|E5105196-2|1
MERGE|ElementEntry|2023/04/01||Loan|IN Legislative Data Group|E|E5105196-2|1
MERGE|ElementEntry|2023/04/01|2023/12/31|Maternity Allowance|IN Legislative Data Group|E|E5105196-2|1


METADATA|ElementEntryValue|EffectiveStartDate|EffectiveEndDate|InputValueName|ScreenEntryValue|AssignmentNumber|ElementName|LegislativeDataGroupName|LegislationCode|MultipleEntryCount|EntryType

MERGE|ElementEntryValue|2023/04/01||Amount|1000|E5105196-2|Assured Bonus|IN Legislative Data Group|IN|1|E
MERGE|ElementEntryValue|2023/04/01||Recovery Months|12|E5105196-2|Assured Bonus|IN Legislative Data Group|IN|1|E
MERGE|ElementEntryValue|2023/04/01||Days|23|E5105196-2|Leave Encashment Days|IN Legislative Data Group|IN|1|E
MERGE|ElementEntryValue|2023/04/01||Amount|2000|E5105196-2|ESPP|IN Legislative Data Group|IN|1|E
MERGE|ElementEntryValue|2023/04/01||Amount|50000|E5105196-2|Loan|IN Legislative Data Group|IN|1|E
MERGE|ElementEntryValue|2023/04/01||Installments|5|E5105196-2|Loan|IN Legislative Data Group|IN|1|E
MERGE|ElementEntryValue|2023/04/01||Percentage|10|E5105196-2|Loan|IN Legislative Data Group|IN|1|E
MERGE|ElementEntryValue|2023/04/01|2023/12/31|Amount|3000|E5105196-2|Maternity Allowance|IN Legislative Data Group|IN|1|E

Friday, 24 March 2023

Legal Employer, Payroll, Address Query Oracle HCM

select papf.person_number,
paaf.assignment_number,
ppnf.full_name,
PAP.PAYROLL_NAME,
PLE.NAME LE_NAME,
paaf.assignment_status_type,
ppos.actual_termination_date,
addr.address_type,
paf.ADDRESS_LINE_1,
paf.ADDRESS_LINE_2,
paf.ADDRESS_LINE_3,
paf.TOWN_OR_CITY,
paf.REGION_2 STATE,
paf.COUNTRY,
paf.POSTAL_CODE,
paf.address_id,
addr.PERSON_ADDR_USAGE_ID
from
per_all_people_f papf,
per_person_names_f ppnf,
per_all_assignments_f paaf,
PER_PERIODS_OF_SERVICE ppos,
pay_payroll_assignments ppasg,
PAY_ASSIGNED_PAYROLLS_DN papd,
pay_all_payrolls_f pap,
per_legal_employers ple,
per_person_addr_usages_f addr,          
per_addresses_f paf 
where 1=1
and papf.person_id = paaf.person_id
and papf.person_id = ppnf.person_id
and papf.person_id = ppos.person_id
and paaf.period_of_service_id = ppos.period_of_service_id
and paaf.assignment_id = ppasg.hr_assignment_id
AND paaf.work_terms_assignment_id = ppasg.hr_term_id
--and paaf.person_id = ppasg.person_id
and ppasg.payroll_term_id = papd.payroll_term_id(+)
and papd.payroll_id = pap.payroll_id(+)
and paaf.legal_entity_id = ple.organization_id
and paaf.person_id = addr.person_id(+)
and addr.address_id = paf.address_id
and addr.address_type(+) = 'HOME'
and ple.status = 'A'
and paaf.PRIMARY_FLAG ='Y'
--and paaf.ASSIGNMENT_TYPE = 'E'
and ppnf.name_type='GLOBAL'
AND PPOS.date_start = (SELECT max(date_start) FROM PER_PERIODS_OF_SERVICE PPOS_IN WHERE PPOS_IN.person_id = PAPF.person_id)
and trunc(sysdate) between papf.effective_start_date and papf.effective_end_date
and trunc(sysdate) between ppnf.effective_start_date and ppnf.effective_end_date
and Nvl(ppos.actual_termination_date, trunc(sysdate)) between paaf.effective_start_date and paaf.effective_end_date
AND  Nvl(ppos.actual_termination_date, trunc(sysdate)) BETWEEN ppasg.start_date AND ppasg.end_date
AND  Nvl(ppos.actual_termination_date, trunc(sysdate)) BETWEEN papd.start_date(+) AND papd.end_date(+)
--AND Nvl(ppos.actual_termination_date, trunc(sysdate)) BETWEEN ppasg.start_date AND ppasg.end_date
and trunc(sysdate) between addr.effective_start_date(+) and addr.effective_end_date(+)
and trunc(sysdate) between paf.effective_start_date(+) and paf.effective_end_date(+)
--and PLE.NAME = 'US1 LE'
--and papf.person_number in ('123123')

Tuesday, 28 February 2023

Element Input Value Required Flag Change

You can't update the required indicator for an input value that was saved.
If no element entries were created for the element, you can delete the input value and add it again with the correct setting.




Element Input Value UOM change

You can only update units of measure to another units type that's similar.
For example, you can change from hours in decimal format (1 decimal place) to hours in decimal format (3 decimal places), but you can't change from character format to date format or monetary format.



Thursday, 23 February 2023

Element Entries Sql


*****************Assigned Payroll***********************
select distinct 
       peo.person_number,
       ppr.payroll_relationship_number,
       asg.assignment_number,
       ppp.payroll_name,
       to_char(asg.RELATIONSHIP_GROUP_ID)               as payroll_assignment_id,
       to_char(pap.assigned_payroll_id)                 as assigned_payroll_id,
       to_char(pap.start_date,            'YYYY/MM/DD') as ppr_start,
       to_char(pap.end_date,              'YYYY/MM/DD') as ppr_end,
       popm.ORG_PAYMENT_METHOD_NAME,
       min(ppp.effective_start_date)||'~'||max(ppp.effective_end_date) payroll_range,
       min(pou.effective_start_date)||'~'||max(pou.effective_end_date) usage_range,
       min(popm.effective_start_date)||'~'||max(popm.effective_end_date) opm_range       
from   pay_pay_relationships_dn       ppr, /* payroll relationship */
       pay_dates                      rdt,
       pay_time_definitions           rtd,
       per_all_people_f               peo,
       pay_rel_groups_dn              asg,
       PAY_ASSIGNED_PAYROLLS_DN       pap,
       PAY_ALL_PAYROLLS_F             ppp,
       PAY_ORG_PAY_METHOD_USAGES_F    pou,
       PAY_ORG_PAY_METHODS_vl popm
where  peo.person_number             = 'WK_1997'
and    ppr.person_id                 = peo.person_id
and    asg.PAYROLL_RELATIONSHIP_ID= ppr.PAYROLL_RELATIONSHIP_ID
and    asg.GROUP_TYPE='A'
and    asg.PARENT_REL_GROUP_ID = pap.PAYROLL_TERM_ID
and    pap.payroll_id = ppp.payroll_id
and    pou.payroll_id (+) = pap.payroll_id
and    popm.ORG_PAYMENT_METHOD_ID (+) = pou.ORG_PAYMENT_METHOD_ID
--and    pap.start_date between ppp.effective_start_date and ppp.effective_end_date
--and    pap.start_date between pou.effective_start_date (+) and pou.effective_end_date (+)
--and    pou.effective_start_date between popm.effective_start_date (+) and popm.effective_end_date (+)
and    rdt.source_id            (+)  = asg.RELATIONSHIP_GROUP_ID
and    rdt.source_type          (+)  = 'PA'
and    rtd.time_definition_id   (+)  = rdt.time_definition_id
group by peo.person_number,
       ppr.payroll_relationship_number,
       asg.assignment_number,
       ppp.payroll_name,
       to_char(asg.RELATIONSHIP_GROUP_ID),
       to_char(pap.assigned_payroll_id),
       to_char(pap.start_date,            'YYYY/MM/DD'),
       to_char(pap.end_date,              'YYYY/MM/DD'),
       popm.ORG_PAYMENT_METHOD_NAME
order by peo.person_number,
       ppr.payroll_relationship_number,
       asg.assignment_number,
       ppp.payroll_name,
       to_char(asg.RELATIONSHIP_GROUP_ID),
       to_char(pap.assigned_payroll_id),
       to_char(pap.start_date,            'YYYY/MM/DD'),
       to_char(pap.end_date,              'YYYY/MM/DD'),
       popm.ORG_PAYMENT_METHOD_NAME



*****************Element setup***********************
select petf.element_type_id
,pettl.element_name
,petf.processing_type Recurring_NonRecurring
,petf.effective_start_date
,petf.effective_end_date
,petf.multiple_entries_allowed_flag 
,pivf.base_name
from pay_element_types_f petf
,pay_element_types_tl pettl
,pay_input_values_f pivf
where petf.element_type_id = pettl.element_type_id
and pivf.element_type_id=petf.element_type_id 
and pettl.element_name = 'WK_Bonus'
and pettl.language='US'
and pivf.user_enterable_flag='Y'
*****************Element Entries***********************
 
     select aaa.person_number,aaa.element_name,aaa.creator_type,aaa.created_by,aaa.creation_Date,aaa.entry_range,
       (select min(date_from)||'~'||max(date_to) from pay_entry_usages where element_entry_id=aaa.element_entry_id)  usage_range,
       aaa.element_entry_id,
       (select --LISTAGG(piv.name, '; ') WITHIN GROUP (ORDER BY piv.display_sequence) 
               rtrim(xmlserialize(content extract(xmlagg(xmlelement("e", piv.name||'; ') order by piv.display_sequence), '//text()')), ',' )
          from PAY_INPUT_VALUES_VL piv 
         where piv.element_type_id = aaa.element_type_id and aaa.start_Date between piv.effective_start_date and piv.EFFECTIVE_END_DATE) inputs,
       (select --LISTAGG(piv.name||'='||peev.screen_entry_value, '; ') WITHIN GROUP (ORDER BY piv.display_sequence) 
               rtrim(xmlserialize(content extract(xmlagg(xmlelement("e", piv.name||'='||peev.screen_entry_value||'; ') order by piv.display_sequence), '//text()')), ',' )
          from PAY_INPUT_VALUES_VL piv,pay_element_entry_values_f peev 
         where peev.element_entry_id = aaa.element_entry_id and peev.input_value_id = piv.input_value_id 
           and piv.element_type_id = aaa.element_type_id and aaa.start_Date between piv.effective_start_date and piv.EFFECTIVE_END_DATE 
           and aaa.start_Date between peev.effective_start_date and peev.EFFECTIVE_END_DATE) input_values,
       (select max('PERL:'||prl.payroll_relationship_number||'('||prl.payroll_relationship_id||'); '||'TERM:'||trm.assignment_number||'('||trm.relationship_group_id||'); '||'ASG:'||asg.assignment_number||'('||asg.relationship_group_id||'); ')
          from pay_entry_usages peu,
               pay_rel_groups_dn asg,
               pay_rel_groups_dn trm,
               PAY_PAY_RELATIONSHIPS_DN prl
         where peu.element_entry_id=aaa.element_entry_id
           and peu.payroll_assignment_id=asg.relationship_group_id (+)
           and peu.payroll_term_id=trm.relationship_group_id (+)
           and peu.payroll_relationship_id = prl.payroll_relationship_id
       ) Payroll_Employment,
       (select max('TERM:'||htrm.assignment_number||'('||htrm.assignment_id||'); '||'ASG:'||hasg.assignment_number||'('||hasg.assignment_id||'); ')
          from pay_entry_usages peu,
               pay_rel_groups_dn asg,
               pay_rel_groups_dn trm,
               per_all_assignments_m hasg,
               per_all_assignments_m htrm
         where peu.element_entry_id=aaa.element_entry_id
           and peu.payroll_assignment_id=asg.relationship_group_id (+)
           and peu.payroll_assignment_id=trm.relationship_group_id (+)
           and hasg.assignment_id (+) = asg.assignment_id
           and htrm.assignment_id (+) = trm.term_id
           ) HR_Employment
  from (select peo.person_number,
               pet.element_name,
               pee.creator_type,
               pee.created_by,
               pee.creation_Date,
               pee.element_entry_id,
               pee.element_type_id,
               min(pee.effective_start_date) as start_Date,
               min(pee.effective_start_date)||'~'||max(pee.effective_end_date) entry_range
        from   per_all_people_f               peo,
               pay_element_entries_f pee,
               pay_element_types_vl  pet
        where  peo.person_number  = 'WK_1997'
        and    pee.person_id = peo.person_id
        and    pee.element_type_id = pet.element_type_id
        group  by peo.person_number,
               pet.element_name,
               pee.element_type_id,
               pee.creator_type,
               pee.created_by,
               pee.creation_Date,
               pee.element_entry_id) aaa      
order by aaa.person_number,
       aaa.element_name,
       aaa.creator_type,
       aaa.created_by,
       aaa.creation_Date,
       aaa.element_entry_id
 

Elements HDL, Element Input Values HDL, Element Eligibility HDL

PayrollElementDetails.dat

METADATA|PayrollElementDetails|ElementName|ReportingName|Description|LegislativeDataGroupName|PrimaryClassificationName|SecondaryClassificationName|Category|ElementStartDate
METADATA|PayrollElementQuestionnaire|ElementName|LegislativeDataGroupName|RuleCode|Rule|Response
MERGE|PayrollElementDetails|AL HDL Test1|AL HDL Test1|AL HDL Test1|IN Legislative Data Group|Standard Earnings|||1951/01/01
MERGE|PayrollElementQuestionnaire|AL HDL Test1|IN Legislative Data Group|SpecCurrency|Input Currency|Indian Rupee
MERGE|PayrollElementQuestionnaire|AL HDL Test1|IN Legislative Data Group|Availability Rule|Should every person eligible for the element automatically receive it?|No
MERGE|PayrollElementQuestionnaire|AL HDL Test1|IN Legislative Data Group|Hire Process|What is the earliest entry date for this element?|First Standard Earning Date
MERGE|PayrollElementQuestionnaire|AL HDL Test1|IN Legislative Data Group|Terminate Process|What is the latest entry date for this element?|Last Standard Earning Date
MERGE|PayrollElementQuestionnaire|AL HDL Test1|IN Legislative Data Group|Processing Level|At which employment level should this element be attached?|Assignment level
MERGE|PayrollElementQuestionnaire|AL HDL Test1|IN Legislative Data Group|Processing Asg Level|Do you want the element to be processed at Payroll Assignment level?|Yes
MERGE|PayrollElementQuestionnaire|AL HDL Test1|IN Legislative Data Group|Recurring Or NonRecurring|Does this element recur each payroll period, or does it require explicit entry?|Nonrecurring
MERGE|PayrollElementQuestionnaire|AL HDL Test1|IN Legislative Data Group|Multiple Entries|Can a person have more than one entry of this element in a payroll period?|No
MERGE|PayrollElementQuestionnaire|AL HDL Test1|IN Legislative Data Group|CalculationRuleBasic|What is the calculation rule?|Flat amount


PayrollElementDefinition.dat

METADATA|PayrollElementDefinition|ElementCode|EffectiveStartDate|EffectiveEndDate|LegislativeDataGroupName|ReportingName|Description
MERGE|PayrollElementDefinition|AL HDL Test1|1951/01/01||IN Legislative Data Group|AL HDL Test1|AL HDL Test1

METADATA|InputValue|EffectiveStartDate|EffectiveEndDate|Name|InputValueCode|ValueRequiredFlag|CreateDatabaseItemFlag|UOM|DisplayFlag|AllowUserEntryFlag|ElementCode|DisplaySequence|LegislativeDataGroupName|ApplyDefaultAtRuntimeFlag
MERGE|InputValue|1951/01/01||Test Input Value|Test Input Value|Y|Y|N|Y|Y|AL HDL Test1|100|IN Legislative Data Group|N

METADATA|ElementEligibility|EffectiveStartDate|EffectiveEndDate|ElementEligibilityName|AutomaticEntryFlag|ElementCode|LegislativeDataGroupName|LegalEmployerCode
MERGE|ElementEligibility|1951/01/01||AL HDL Test1 Elig|N|AL HDL Test1|IN Legislative Data Group|LE_NAME

FTE update HDL

The SET command is required to update the FTE in work measures table when changing the working hours of an employee. IF you change it without the SET command the hours get updated but not the FTE.


SET CALCULATE_FTE Y
METADATA|WorkTerms|AssignmentNumber|PersonNumber|LegalEmployerName|DateStart|WorkerType|EffectiveStartDate|EffectiveEndDate|EffectiveSequence|EffectiveLatestChange|ActionCode|NormalHours
MERGE|WorkTerms|ET29611|29611|LE_NAME|2009/01/19|E|2022/08/01||1|Y|ASG_CHANGE|20
METADATA|Assignment|WorkTermsNumber|PersonNumber|AssignmentNumber|LegalEmployerName|DateStart|WorkerType|EffectiveStartDate|EffectiveEndDate|EffectiveSequence|ActionCode|EffectiveLatestChange|NormalHours
MERGE|Assignment|ET29611|29611|E29611|LE_NAME|2009/01/19|E|2022/08/01||1|ASG_CHANGE|Y|20

Element HDL Template Generator Report

 Hi Everyone,

I was trying to create an element using HDL but it was not created as all the Questions in the element questionaire were not being passed. There is a wonderful post on customer connect to generate the HDL file from a sample element created in the application which has resolved my issue. Thanks.

https://community.oracle.com/customerconnect/discussion/505001/element-hdl-template-generator-report

The value CalculationRule isn't valid for the attribute RuleName.

Hi Everyone,

I was trying to create an element using but I was facing the below issue.

The value CalculationRule isn't valid for the attribute RuleName.

The reason I was facing this is I missed a Question in the questionnare part of the HDL.

The below 2 lines need to be added instead of just the first line which is visible in the UI on the summary page when we are submitting the element for creation. Only the first one was visible, but HDL needed the second line also to be passed along with the first line.

MERGE|PayrollElementQuestionnaire|AL HDL Test1|IN Legislative Data Group|Processing Level|At which employment level should this element be attached?|Assignment level
MERGE|PayrollElementQuestionnaire|AL HDL Test1|IN Legislative Data Group|Processing Asg Level|Do you want the element to be processed at Payroll Assignment level?|Yes


Sample HDL
METADATA|PayrollElementDetails|ElementName|ReportingName|Description|LegislativeDataGroupName|PrimaryClassificationName|SecondaryClassificationName|Category|ElementStartDate
METADATA|PayrollElementQuestionnaire|ElementName|LegislativeDataGroupName|RuleCode|Rule|Response
MERGE|PayrollElementDetails|AL HDL Test1|AL HDL Test1|AL HDL Test1|IN Legislative Data Group|Standard Earnings|||1951/01/01
MERGE|PayrollElementQuestionnaire|AL HDL Test1|IN Legislative Data Group|SpecCurrency|Input Currency|Indian Rupee
MERGE|PayrollElementQuestionnaire|AL HDL Test1|IN Legislative Data Group|Availability Rule|Should every person eligible for the element automatically receive it?|No
MERGE|PayrollElementQuestionnaire|AL HDL Test1|IN Legislative Data Group|Hire Process|What is the earliest entry date for this element?|First Standard Earning Date
MERGE|PayrollElementQuestionnaire|AL HDL Test1|IN Legislative Data Group|Terminate Process|What is the latest entry date for this element?|Last Standard Earning Date
MERGE|PayrollElementQuestionnaire|AL HDL Test1|IN Legislative Data Group|Processing Level|At which employment level should this element be attached?|Assignment level
MERGE|PayrollElementQuestionnaire|AL HDL Test1|IN Legislative Data Group|Processing Asg Level|Do you want the element to be processed at Payroll Assignment level?|Yes
MERGE|PayrollElementQuestionnaire|AL HDL Test1|IN Legislative Data Group|Recurring Or NonRecurring|Does this element recur each payroll period, or does it require explicit entry?|Nonrecurring
MERGE|PayrollElementQuestionnaire|AL HDL Test1|IN Legislative Data Group|Multiple Entries|Can a person have more than one entry of this element in a payroll period?|No
MERGE|PayrollElementQuestionnaire|AL HDL Test1|IN Legislative Data Group|CalculationRuleBasic|What is the calculation rule?|Flat amount

The values Earnings aren't valid for the attribute PrimaryClassificationId.

Hi Everyone,
I was facing an issue trying to load the elements using HDL. I was getting below error. 
"The values Earnings aren't valid for the attribute PrimaryClassificationId."
The issue was being caused as the base classification name has to be passed instead of the classification name in the HDL. In my case I was passing Earnings instead of Standard Earnings.


Sample HDL below.

METADATA|PayrollElementDetails|ElementName|ReportingName|Description|LegislativeDataGroupName|PrimaryClassificationName|SecondaryClassificationName|Category|ElementStartDate
METADATA|PayrollElementQuestionnaire|ElementName|LegislativeDataGroupName|RuleCode|Rule|Response
MERGE|PayrollElementDetails|AL HDL Test1|AL HDL Test1|AL HDL Test1|IN Legislative Data Group|Standard Earnings|||1951/01/01
MERGE|PayrollElementQuestionnaire|AL HDL Test1|IN Legislative Data Group|SpecCurrency|Input Currency|Indian Rupee
MERGE|PayrollElementQuestionnaire|AL HDL Test1|IN Legislative Data Group|Availability Rule|Should every person eligible for the element automatically receive it?|No
MERGE|PayrollElementQuestionnaire|AL HDL Test1|IN Legislative Data Group|Hire Process|What is the earliest entry date for this element?|First Standard Earning Date
MERGE|PayrollElementQuestionnaire|AL HDL Test1|IN Legislative Data Group|Terminate Process|What is the latest entry date for this element?|Last Standard Earning Date
MERGE|PayrollElementQuestionnaire|AL HDL Test1|IN Legislative Data Group|Processing Level|At which employment level should this element be attached?|Assignment level
MERGE|PayrollElementQuestionnaire|AL HDL Test1|IN Legislative Data Group|Processing Asg Level|Do you want the element to be processed at Payroll Assignment level?|Yes
MERGE|PayrollElementQuestionnaire|AL HDL Test1|IN Legislative Data Group|Recurring Or NonRecurring|Does this element recur each payroll period, or does it require explicit entry?|Nonrecurring
MERGE|PayrollElementQuestionnaire|AL HDL Test1|IN Legislative Data Group|Multiple Entries|Can a person have more than one entry of this element in a payroll period?|No
MERGE|PayrollElementQuestionnaire|AL HDL Test1|IN Legislative Data Group|CalculationRuleBasic|What is the calculation rule?|Flat amount

Wednesday, 8 February 2023

BI Publisher- Excel Template - Print rows conditionally

When using excel template in BI Publisher, there are times when we want to print certain rows in output file based on the value of a column. Instead of the normal group tag, add the group tag as below in XDO_METADATA sheet.





Sample XML Data:
<DATA_DS>
<G_1>
<emp_no>101</emp_no>
<emp_name>Arjun</emp_name>
<ENROLLED>yes</ENROLLED>
</G_1>
<G_1>
<emp_no>102</emp_no>
<emp_name>Bharat</emp_name>
<ENROLLED>no</ENROLLED>
</G_1>
<G_1>
<emp_no>103</emp_no>
<emp_name>Charan</emp_name>
<ENROLLED>no</ENROLLED>
</G_1>
<G_1>
<emp_no>104</emp_no>
<emp_name>Dinesh</emp_name>
<ENROLLED>yes</ENROLLED>
</G_1>
</DATA_DS>


XML- XSLT transformation online

Below website is very useful to check if your XSL template is transforming the XML as required.

https://www.freeformatter.com/xsl-transformer.html

Monday, 30 January 2023

HCM Extracts - BI Report not running

If you have an extract delivery option linked to the BI report, add the below 3 permissions to the BI report so that the output is generated.

Enterprise Scheduler Job Application Identity for HCM
Manage HCM Extract Definition Report
Run HCM Extracts Report