HDL – Sample file to end date element entry value
All recurring element entires are loaded/ created with an effective end date of 31-Dec-4712. But I have seen scenarios, where the business have requirements to end date an element entry as of a certain date. To achieve this in Bulk, one can use ElementEntry.dat HDL business object.
Let us take an example, where an employee has an element entry with an effective end date of 31-Dec-4712:
The effective end date is set to blank which is equivalent to 31-Dec-4712 in the backend table.
So, let us assume the business has requested to end date this particular element as of 31-Jan-2024 for all employees. To achieve, this we need to pull the existing data from element entries table for this particular element. Below SQL can be used to get the ID values and to verify the results before and after HDL load:
SELECT DISTINCT peevf.element_entry_value_id
,peef.element_entry_id
,petf.base_element_name
,peef.effective_start_date ele_sd
,peef.effective_end_date ele_ed
,peevf.effective_start_date
,peevf.effective_end_date
,paam.assignment_number
FROM per_all_assignments_m paam
,pay_element_types_f petf
,pay_element_entries_f peef
,pay_element_entry_values_f peevf
WHERE 1=1
AND paam.person_id = peef.person_id
AND peef.element_type_id = petf.element_type_id
AND peef.element_entry_id = peevf.element_entry_id
AND paam.ASSIGNMENT_TYPE in ('E')
AND paam.primary_assignment_flag = 'Y'
AND petf.base_element_name = 'Test XYZ Bonus'
AND paam.assignment_number = 'E2121212'
AND trunc(sysdate) between petf.effective_start_date and petf.effective_end_date
AND trunc(sysdate) between paam.effective_start_date and paam.effective_end_date
A normal HDL file with new effective end date will just create a date split in the data. To avoid this a new attribute called ReplaceLastEffectiveEndDate should be added in the HDL file which will updated the effective end date from 31-Dec-4712 to 31-Jan-2024.
METADATA|ElementEntry|AssignmentNumber|ElementName|EffectiveStartDate|EffectiveEndDate|LegislativeDataGroupName|MultipleEntryCount|EntryType|ReplaceLastEffectiveEndDate
MERGE|ElementEntry|E2121212|Test XYZ Bonus|2012/01/31|2024/01/31|GB Legislative Data Group|1|E|Y
Once this HDL is run successfully, the effective end date will get updted.