Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [{
- "WD_Correlation_ID": "3297ab71-42d7-4e6d-9166-40315dc79111",
- "WD_Correlation_SeqNo": 1,
- "WD_Correlation_Group_Size": 4,
- "EMPLID": 114621,
- "EMPL_RCD": 1,
- "EFFDT": "07/06/2018",
- "EFFSEQ": 1,
- "HR_STATUS": "A",
- "EMPL_STATUS": "A",
- "PER_ORG": "EMP",
- "LAST_NAME": "Alfonso",
- "FIRST_NAME": "Frank",
- "MIDDLE_NAME": "P",
- "MIDDLE_INITIAL": "P",
- "PREF_FIRST_NAME": "Frank",
- "LAST_FOUR_NID": "",
- "LDAPUSERDN": 114621,
- "EMAIL_ADDR": "NEEDED",
- "ASC_DIR_GROUP": "Corporate",
- "ASC_AD_DISTINGUISH": "000114621",
- "WORK_PHONE": "",
- "MANAGER": "Y",
- "MANAGER_LEVEL": 8,
- "POSITION_NBR": "2117948",
- "HIRE_DT": "2016-02-26",
- "LAST_HIRE_DT": "2016-02-26",
- "TERMINATION_DT": "",
- "SETID": 1,
- "BUSINESS_UNIT": "",
- "COMPANY": "Autopart International",
- "PAYGROUP": "AAP",
- "ACCT_CD": "AI112D07",
- "DEPTID": "AI112D07",
- "DEPTNAME": "District 7",
- "JOBCODE": 221020,
- "JOBTITLE": "Manager, Logistics",
- "JOBTITLE_ABBRV": "Manager, L",
- "JOB_FAMILY": "Logistics",
- "FULL_PART_TIME": "F",
- "EMPL_CLASS": "Regular",
- "EMPL_TYPE": "Salary",
- "REG_TEMP": "Regular",
- "SHIFT": "",
- "REPORTS_TO": 116030,
- "MANAGER_ID": 2118390,
- "MANAGER_NAME": "Derek John",
- "LOCATION": "AI2112",
- "LOCATION_DESCR": "Store 2112 - Lakewood",
- "ADDRESS1": "175 Oberlin Ave",
- "ADDRESS2": "Unit 2",
- "ADDRESS3": "",
- "ADDRESS4": "",
- "LOCATION_CITY": "Lakewood",
- "LOCATION_STATE": "New Jersey",
- "LOCATION_POSTAL": 8701,
- "ASC_LOC_COUNTRY": "US",
- "ASC_LOCATION_PHONE": "+1 (732) 886-9532",
- "ASC_AREA": "AI",
- "ASC_REGION": "7-DIST",
- "ASC_DIVISION": "",
- "ASC_STORE_NBR": "",
- "ASC_KEY_CARRIER": "Y",
- "ASC_TERRITORY": "",
- "CONTRACT_BEGIN_DT": "",
- "CONTRACT_END_DT": "",
- "ACTION": "DTA",
- "ACTION_REASON": "DTA",
- "ACTION_DT": "07/06/2018",
- "HR_Director": "",
- "Leadership": "District Manager / DC Dept Manager / WP - Reg Ops Manager",
- "HR_Manager": "Pamela Johnson",
- "GPI_Legacy_Employee_Number": "",
- "GPI_Location_Code": "",
- "Organization_Name": "",
- "SSN": "",
- "Date_of_Birth": "1964-06-29",
- "Marital_Status": "Single_United_States_of_America",
- "Home_Phone": "",
- "Home_Address": "120 hancock ave",
- "Home_Address_City": "seaside",
- "Home_Address_State": "New Jersey",
- "Home_Zip": "08751",
- "Home_Country": "US",
- "Ethnic_Origin": "Declined_to_Answer_United_States_of_America",
- "Job_Exempt": "Exempt",
- "Scheduled_Weekly_Hours": 40,
- "Suffix": "",
- "Pay_Frequency": "Biweekly",
- "Gender": "Not Declared",
- "GPI_Access_Reason": "",
- "Preferred_Last_Name": "Alfonso"
- }
- ]
- %dw 2.0
- output application/csv headerLineNumber = 0 , header = true , separator = "|"
- /*
- * The following function provides the logic to check if the custom field
- * contains the word GPIU within the first 4 positions of the string.
- * */
- fun checkForGPIU(GPI_Legacy_Employee_Number) = if(GPI_Legacy_Employee_Number[0 to 3] contains "GPIU")
- "true"
- else
- "false"
- /*
- * The following function make a substring of the given string
- * starting at position 5 (the array start position is 0)
- * and ending when the string end
- * */
- fun stripGPIU(GPI_Legacy_Employee_Number) = GPI_Legacy_Employee_Number[4 to (sizeOf(GPI_Legacy_Employee_Number)-1)]
- /*
- * Variables declared to hold the domain values of an employee status
- *
- */
- var activeEmployeesArray=["A", "L", "P"]
- var exEmployeeArray=["T", "D"]
- ---
- payload map (m, i) -> {
- TEAMMATE_ID: if(isEmpty(m.GPI_Legacy_Employee_Number))
- m.EMPLID
- else
- if(checkForGPIU(m.GPI_Legacy_Employee_Number)=="true")
- stripGPIU(m.GPI_Legacy_Employee_Number)
- else
- m.GPI_Legacy_Employee_Number, /* Logic */
- FIRST_NAME: m.FIRST_NAME,
- MIDDLE_NAME: m.MIDDLE_NAME,
- LAST_NAME: m.LAST_NAME,
- PREFERRED_NAME: m.PREF_FIRST_NAME,
- COMPANY: m.COMPANY,
- JOB_TITLE: m.JOBTITLE,
- ORGANIZATION_NAME: m.Organization_Name,
- LOCATION_CITY: m.Home_Address_City ,
- LOCATION_STATE: m.Home_Address_State,
- STORE_KEY: m.ASC_STORE_NBR,
- SUPERVISOR_NAME: m.MANAGER_NAME,
- SUPERVISOR_ID: m.MANAGER_ID, /* todo: Check */
- ASSIGNMENT_CATEGORY: m.FULL_PART_TIME, /* Logic change in june 27th */
- HIRE_DATE: m.HIRE_DT,
- TERM_DATE: m.TERMINATION_DT,
- COUNTRY: m.HOME_COUNTRY,
- HR_BUSINESS_UNIT: m.BUSINESS_UNIT, /* BLANK */
- HR_DIVISION: m.ASC_DIVISION, /* BLANK */
- HR_DEPARTMENT: m.DEPTNAME, /* BLANK */
- HR_DIRECTOR: m.HR_Director, /* BLANK */
- LEADERSHIP: m.MANAGER_LEVEL,
- PERSON_TYPE: if(activeEmployeesArray contains m.EMPL_STATUS)
- if(m.PER_ORG == "EMP")
- 'Employee'
- else
- 'CWK'
- else if (exEmployeeArray contains m.EMPL_STATUS)
- if(m.PER_ORG == "EMP")
- 'Ex-Employee'
- else
- 'Ex-CWK'
- else
- '', /* Logic */
- HR_MANAGER: m.HR_Manager,
- AAP_EMPLOYEE_ID: m.EMPLID
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement