/* Input Data */
INPUTS ARE OPERATION (text)
, LINESEQUENCE (number)
, LINEREPEAT (text)
, LINEREPEATNO (number)
, POSITION1 (text)
, POSITION2 (text)
, POSITION3 (text)
, POSITION4 (text)
, POSITION5 (text)
, POSITION6 (text)
, POSITION7 (text)
, POSITION8 (text)
DEFAULT FOR POSITION1 IS 'NO DATA'
DEFAULT FOR POSITION2 IS 'NO DATA'
DEFAULT FOR POSITION3 IS 'NO DATA'
DEFAULT FOR POSITION4 IS 'NO DATA'
DEFAULT FOR POSITION5 IS 'NO DATA'
DEFAULT FOR POSITION6 IS 'NO DATA'
DEFAULT FOR POSITION7 IS 'NO DATA'
DEFAULT FOR POSITION8 IS 'NO DATA'
DEFAULT FOR POSITION9 IS 'NO DATA'
/* DEFAULT FOR POSITION10 IS 'NO DATA'
DEFAULT FOR POSITION11 IS 'NO DATA' */
DEFAULT FOR LINESEQUENCE IS 1
DEFAULT FOR LINEREPEATNO IS 1
DEFAULT FOR GLOBAL_PAY_INTERFACE_EXTRACTION_DATE is ' '
IF OPERATION='FILETYPE' THEN
OUTPUTVALUE='DELIMITED'
ELSE IF OPERATION='DELIMITER' THEN
OUTPUTVALUE='|'
ELSE IF OPERATION='READ' THEN
OUTPUTVALUE='NONE'
ELSE IF OPERATION = 'NUMBEROFBUSINESSOBJECTS' THEN
(
OUTPUTVALUE = '2'
RETURN OUTPUTVALUE
)
ELSE IF OPERATION = 'METADATALINEINFORMATION' THEN
(
METADATA1[1] = 'PersonAbsenceEntry'
METADATA1[2] = 'PersonAbsenceEntry'
METADATA1[3] = 'PerAbsenceEntryId'
METADATA1[4] = 'Employer'
METADATA1[5] = 'PersonNumber'
METADATA1[6] = 'AbsenceType'
METADATA1[7] = 'AbsenceReason'
METADATA1[8] = 'AbsenceStatus'
METADATA1[9] = 'ApprovalStatus'
METADATA1[10] = 'StartDate'
METADATA1[11] = 'StartTime'
METADATA1[12] = 'EndDate'
METADATA1[13] = 'EndTime'
METADATA1[14] = 'SubmittedDate'
METADATA1[15] = 'NotificationDate'
METADATA1[16] = 'BlockedLeaveCandidate'
METADATA1[17] = 'StartDateDuration'
METADATA2[1] = 'PersonAbsenceEntry'
METADATA2[2] = 'PersonAbsenceEntryDetail'
METADATA2[3] = 'PerAbsEntryDtlId'
METADATA2[4] = 'PerAbsenceEntryId'
METADATA2[5] = 'AbsenceDate'
METADATA2[6] = 'AbsenceDatetime'
METADATA2[7] = 'AbsenceEndDatetime'
METADATA2[8] = 'Duration'
METADATA2[9] = 'EndTime'
METADATA2[10] = 'StartTime'
METADATA2[11] = 'GUID'
METADATA2[12] = 'SourceSystemId'
METADATA2[13] = 'SourceSystemOwner'
METADATA2[14] = 'Employer'
METADATA2[15] = 'EmployerId'
METADATA2[16] = 'PersonNumber'
METADATA2[17] = 'PersonId'
METADATA2[18] = 'AbsenceType'
METADATA2[19] = 'AbsenceTypeId'
METADATA2[20] = 'AssignmentNumber'
METADATA2[21] = 'AssignmentId'
METADATA2[22] = 'AbsenceStartDate'
METADATA2[23] = 'AbsenceStartTime'
METADATA2[24] = 'RowSeq'
RETURN METADATA1,METADATA2
)
ELSE IF OPERATION='MAP' THEN
(
l_Abs_Entry_ID = ' '
l_Abs_Entry_Dtl_ID = ' '
l_Abs_Duration = ' '
l_Abs_Hours = 0
l_Asg_Details = 'NONE'
l_Delimiter1_pos = 0
l_Delimiter2_pos = 0
l_Delimiter3_pos = 0
l_CMP = POSITION1
l_DEPTID = POSITION2
l_EMPLID = POSITION3
l_EffDt = to_char(to_date(POSITION4, 'yyyymmdd'), 'yyyy/mm/dd')
l_TRC = POSITION5
l_TL_Qty = POSITION6
If Length(l_TL_Qty) = 0 Then (
l_TL_Qty = '0'
)
/* AbsenceType = GET_VALUE_SET('GET_ABSENCE_TYPE','|=P_TRC='''||l_TRC||'''') */
AbsenceType = l_TRC
l_sysdate = GLOBAL_PAY_INTERFACE_EXTRACTION_DATE
l_sysdate = substring(l_sysdate, 1, 4) || '/' || substring(l_sysdate, 5, 2) ||'/'|| substring(l_sysdate, 7, 2)
l_Abs_Hours = to_number(l_TL_Qty)/100
l_Asg_Details = GET_VALUE_SET('GET_ASG_DETAILS','|=P_PER_NUM='''||l_EMPLID||''''||'|P_DUR='''||l_EffDt||'''')
l_Delimiter1_pos = INSTR(l_Asg_Details, '*',1,1)
l_Delimiter2_pos = INSTR(l_Asg_Details, '*',1,2)
l_PersonID = SUBSTR(l_Asg_Details, 1, l_Delimiter1_pos-1)
l_Employer = SUBSTR(l_Asg_Details, l_Delimiter1_pos+1, l_Delimiter2_pos-(l_Delimiter1_pos+1))
l_Abs_Details = GET_VALUE_SET('GET_ABSENCE_DETAILS','|=P_PERSONID='''||l_PersonID||''''||'|P_DUR='''||l_EffDt||''''||'|P_ABS_TYPE='''||AbsenceType||'''')
If Length(l_Abs_Details) > 1 Then (
l_Delimiter1_pos = INSTR(l_Abs_Details, '*',1,1)
l_Delimiter2_pos = INSTR(l_Abs_Details, '*',1,2)
l_Delimiter3_pos = INSTR(l_Abs_Details, '*',1,3)
l_Abs_Entry_ID = SUBSTR(l_Abs_Details, 1, l_Delimiter1_pos-1)
l_Abs_Entry_Dtl_ID = SUBSTR(l_Abs_Details, l_Delimiter1_pos+1, l_Delimiter2_pos-(l_Delimiter1_pos+1))
l_Abs_Duration = SUBSTR(l_Abs_Details, l_Delimiter2_pos+1, l_Delimiter3_pos-(l_Delimiter2_pos+1))
l_Abs_Type = SUBSTR(l_Abs_Details, l_Delimiter3_pos+1, Length(l_Abs_Details))
If isnull(l_Abs_Entry_ID) = 'Y' Then (
l_Abs_Hours = l_Abs_Hours + to_number(l_Abs_Duration)
)
)
FileName = 'PersonAbsenceEntry'
BusinessOperation = 'MERGE'
FileDiscriminator = 'PersonAbsenceEntry'
Employer = l_Employer
PersonNumber = l_EMPLID
AbsenceStatus = 'SUBMITTED'
ApprovalStatus = 'APPROVED'
StartDate = l_EffDt
StartTime = '00:00'
EndDate = l_EffDt
EndTime = '23:59'
SubmittedDate = l_sysdate
NotificationDate = l_sysdate
BlockedLeaveCandidate = 'NA'
StartDateDuration = l_Abs_Hours
AbsenceDate = l_EffDt
Duration = l_Abs_Hours
AbsenceStartDate = l_EffDt
AbsenceStartTime = '00:00'
RowSeq = '1'
PerAbsenceEntryId = l_Abs_Entry_ID
PerAbsEntryDtlId = l_Abs_Entry_Dtl_ID
/*
dummy = ESS_LOG_WRITE('l_EMPLID: '|| l_EMPLID)
dummy = ESS_LOG_WRITE('l_EffDt: '|| l_EffDt)
dummy = ESS_LOG_WRITE('l_sysdate: '|| l_sysdate)
dummy = ESS_LOG_WRITE('l_Employer: '|| l_Employer)
dummy = ESS_LOG_WRITE('l_Abs_Entry_ID: '|| l_Abs_Entry_ID)
dummy = ESS_LOG_WRITE('l_Abs_Entry_Dtl_ID: '|| l_Abs_Entry_Dtl_ID)
dummy = ESS_LOG_WRITE('l_Abs_Duration: '|| l_Abs_Duration)
dummy = ESS_LOG_WRITE('isnull(l_Abs_Entry_ID): '|| isnull(l_Abs_Entry_ID))
*/
If LINEREPEATNO = 1 Then (
LINEREPEAT = 'Y'
FileDiscriminator = 'PersonAbsenceEntry'
If Length(PerAbsenceEntryId) > 1 Then (
Return BusinessOperation, FileName, FileDiscriminator, PerAbsenceEntryId, Employer, PersonNumber, AbsenceType, AbsenceStatus, ApprovalStatus, StartDate, StartTime, EndDate, EndTime, SubmittedDate, NotificationDate, BlockedLeaveCandidate, StartDateDuration, LINESEQUENCE, LINEREPEAT, LINEREPEATNO
)
Else (
Return BusinessOperation, FileName, FileDiscriminator, Employer, PersonNumber, AbsenceType, AbsenceStatus, ApprovalStatus, StartDate, StartTime, EndDate, EndTime, SubmittedDate, NotificationDate, BlockedLeaveCandidate, StartDateDuration, LINESEQUENCE, LINEREPEAT, LINEREPEATNO
)
)
Else If LINEREPEATNO = 2 Then (
LINEREPEAT = 'N'
FileDiscriminator = 'PersonAbsenceEntryDetail'
If Length(PerAbsEntryDtlId) > 1 Then (
Return BusinessOperation, FileName, FileDiscriminator, PerAbsEntryDtlId, AbsenceDate, Duration, Employer, PersonNumber, AbsenceType, AbsenceStartDate, AbsenceStartTime, RowSeq, LINESEQUENCE, LINEREPEAT, LINEREPEATNO
)
Else (
Return BusinessOperation, FileName, FileDiscriminator, AbsenceDate, Duration, Employer, PersonNumber, AbsenceType, AbsenceStartDate, AbsenceStartTime, RowSeq, LINESEQUENCE, LINEREPEAT, LINEREPEATNO
)
)
Else (
LINEREPEAT = 'N'
OUTPUTVALUE = 'NONE'
Return OUTPUTVALUE,LINESEQUENCE,LINEREPEAT,LINEREPEATNO
)
)
ELSE
OUTPUTVALUE='NONE'
RETURN OUTPUTVALUE
/* End Formula Text */
Sample HDL:
METADATA|PersonAbsenceEntry|PerAbsenceEntryId|Employer|PersonNumber|AbsenceType|AbsenceReason|AbsenceStatus|ApprovalStatus|StartDate|StartTime|EndDate|EndTime|SubmittedDate|NotificationDate|BlockedLeaveCandidate|StartDateDuration
MERGE|PersonAbsenceEntry||Company, LLC|12345|Paid Time Off||SUBMITTED|APPROVED|2020/02/27|00:00|2020/02/27|23:59|2020/03/02|2020/03/02|NA|8
METADATA|PersonAbsenceEntryDetail|AbsenceDate|AbsenceDatetime|AbsenceEndDatetime|Duration|EndTime|PerAbsEntryDtlId|PerAbsenceEntryId|StartTime|GUID|SourceSystemId|SourceSystemOwner|Employer|EmployerId|PersonNumber|PersonId|AbsenceType|AbsenceTypeId|AssignmentNumber|AssignmentId|AbsenceStartDate|AbsenceStartTime|RowSeq
MERGE|PersonAbsenceEntryDetail|2020/02/27|||8||||||||Company, LLC||12345||Paid Time Off||||2020/02/27|00:00|1
No comments:
Post a Comment