Thursday, 26 August 2021

HCM Data Loader Transformation formula

Sample Data - Job.txt
----------------------------
Test Job3,TJ3,COMMON,2021/01/01,4712/12/31,A
Test Job4,TJ4,COMMON,2021/01/01,4712/12/31,A


/********************************************************** 
* FORMULA NAME: GENERATE_JOB_HDL_FROM_TXT
* FORMULA TYPE: HCM Data Loader
* DESCRIPTION: This formula will create Job HDL File from TXT File
******************************************************************/
/* Inputs  */
INPUTS ARE  OPERATION (text), LINENO (number),  LINEREPEATNO (number),POSITION1 (text), POSITION2 (text), POSITION3 (text), POSITION4 (text), POSITION5 (text), POSITION6 (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 LINEREPEATNO IS 1

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 = '1'
RETURN OUTPUTVALUE
)

ELSE IF OPERATION = 'METADATALINEINFORMATION' THEN
(   
METADATA1[1]  = 'Job' /*FileName*/ /*Reserved*/
METADATA1[2]  = 'Job' /*FileDiscriminator*/ /*Reserved*/
METADATA1[3]  = 'Name'
METADATA1[4]  = 'JobCode'
METADATA1[5]  = 'SetCode'
METADATA1[6]  = 'EffectiveStartDate'
METADATA1[7]  = 'EffectiveEndDate'
METADATA1[8]  = 'ActiveStatus'
RETURN METADATA1
)

ELSE IF OPERATION='MAP' THEN 
(
IF LINEREPEATNO = 1 THEN
(
LINEREPEAT = 'Y'
FileName = 'Job'
BusinessOperation = 'MERGE'
FileDiscriminator = 'Job'
Name = trim(POSITION1)
JobCode = trim(POSITION2)
SetCode = trim(POSITION3)
EffectiveStartDate = trim(POSITION4)
EffectiveEndDate = trim(POSITION5)
ActiveStatus = trim(POSITION6)
RETURN BusinessOperation,FileName,FileDiscriminator,Name,JobCode,SetCode,EffectiveStartDate,EffectiveEndDate,ActiveStatus,LINEREPEAT,LINEREPEATNO
)
)

ELSE 
   OUTPUTVALUE='NONE'

RETURN OUTPUTVALUE
/* End Formula Text */

No comments:

Post a Comment