Advertisement
Guest User

Untitled

a guest
Jul 12th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.88 KB | None | 0 0
  1.  
  2. [{
  3. "WD_Correlation_ID": "3297ab71-42d7-4e6d-9166-40315dc79111",
  4. "WD_Correlation_SeqNo": 1,
  5. "WD_Correlation_Group_Size": 4,
  6. "EMPLID": 114621,
  7. "EMPL_RCD": 1,
  8. "EFFDT": "07/06/2018",
  9. "EFFSEQ": 1,
  10. "HR_STATUS": "A",
  11. "EMPL_STATUS": "A",
  12. "PER_ORG": "EMP",
  13. "LAST_NAME": "Alfonso",
  14. "FIRST_NAME": "Frank",
  15. "MIDDLE_NAME": "P",
  16. "MIDDLE_INITIAL": "P",
  17. "PREF_FIRST_NAME": "Frank",
  18. "LAST_FOUR_NID": "",
  19. "LDAPUSERDN": 114621,
  20. "EMAIL_ADDR": "NEEDED",
  21. "ASC_DIR_GROUP": "Corporate",
  22. "ASC_AD_DISTINGUISH": "000114621",
  23. "WORK_PHONE": "",
  24. "MANAGER": "Y",
  25. "MANAGER_LEVEL": 8,
  26. "POSITION_NBR": "2117948",
  27. "HIRE_DT": "2016-02-26",
  28. "LAST_HIRE_DT": "2016-02-26",
  29. "TERMINATION_DT": "",
  30. "SETID": 1,
  31. "BUSINESS_UNIT": "",
  32. "COMPANY": "Autopart International",
  33. "PAYGROUP": "AAP",
  34. "ACCT_CD": "AI112D07",
  35. "DEPTID": "AI112D07",
  36. "DEPTNAME": "District 7",
  37. "JOBCODE": 221020,
  38. "JOBTITLE": "Manager, Logistics",
  39. "JOBTITLE_ABBRV": "Manager, L",
  40. "JOB_FAMILY": "Logistics",
  41. "FULL_PART_TIME": "F",
  42. "EMPL_CLASS": "Regular",
  43. "EMPL_TYPE": "Salary",
  44. "REG_TEMP": "Regular",
  45. "SHIFT": "",
  46. "REPORTS_TO": 116030,
  47. "MANAGER_ID": 2118390,
  48. "MANAGER_NAME": "Derek John",
  49. "LOCATION": "AI2112",
  50. "LOCATION_DESCR": "Store 2112 - Lakewood",
  51. "ADDRESS1": "175 Oberlin Ave",
  52. "ADDRESS2": "Unit 2",
  53. "ADDRESS3": "",
  54. "ADDRESS4": "",
  55. "LOCATION_CITY": "Lakewood",
  56. "LOCATION_STATE": "New Jersey",
  57. "LOCATION_POSTAL": 8701,
  58. "ASC_LOC_COUNTRY": "US",
  59. "ASC_LOCATION_PHONE": "+1 (732) 886-9532",
  60. "ASC_AREA": "AI",
  61. "ASC_REGION": "7-DIST",
  62. "ASC_DIVISION": "",
  63. "ASC_STORE_NBR": "",
  64. "ASC_KEY_CARRIER": "Y",
  65. "ASC_TERRITORY": "",
  66. "CONTRACT_BEGIN_DT": "",
  67. "CONTRACT_END_DT": "",
  68. "ACTION": "DTA",
  69. "ACTION_REASON": "DTA",
  70. "ACTION_DT": "07/06/2018",
  71. "HR_Director": "",
  72. "Leadership": "District Manager / DC Dept Manager / WP - Reg Ops Manager",
  73. "HR_Manager": "Pamela Johnson",
  74. "GPI_Legacy_Employee_Number": "",
  75. "GPI_Location_Code": "",
  76. "Organization_Name": "",
  77. "SSN": "",
  78. "Date_of_Birth": "1964-06-29",
  79. "Marital_Status": "Single_United_States_of_America",
  80. "Home_Phone": "",
  81. "Home_Address": "120 hancock ave",
  82. "Home_Address_City": "seaside",
  83. "Home_Address_State": "New Jersey",
  84. "Home_Zip": "08751",
  85. "Home_Country": "US",
  86. "Ethnic_Origin": "Declined_to_Answer_United_States_of_America",
  87. "Job_Exempt": "Exempt",
  88. "Scheduled_Weekly_Hours": 40,
  89. "Suffix": "",
  90. "Pay_Frequency": "Biweekly",
  91. "Gender": "Not Declared",
  92. "GPI_Access_Reason": "",
  93. "Preferred_Last_Name": "Alfonso"
  94. }
  95. ]
  96.  
  97. %dw 2.0
  98. output application/csv headerLineNumber = 0 , header = true , separator = "|"
  99.  
  100. /*
  101. * The following function provides the logic to check if the custom field
  102. * contains the word GPIU within the first 4 positions of the string.
  103. * */
  104. fun checkForGPIU(GPI_Legacy_Employee_Number) = if(GPI_Legacy_Employee_Number[0 to 3] contains "GPIU")
  105. "true"
  106. else
  107. "false"
  108.  
  109. /*
  110. * The following function make a substring of the given string
  111. * starting at position 5 (the array start position is 0)
  112. * and ending when the string end
  113. * */
  114. fun stripGPIU(GPI_Legacy_Employee_Number) = GPI_Legacy_Employee_Number[4 to (sizeOf(GPI_Legacy_Employee_Number)-1)]
  115.  
  116. /*
  117. * Variables declared to hold the domain values of an employee status
  118. *
  119. */
  120. var activeEmployeesArray=["A", "L", "P"]
  121. var exEmployeeArray=["T", "D"]
  122. ---
  123.  
  124. payload map (m, i) -> {
  125. TEAMMATE_ID: if(isEmpty(m.GPI_Legacy_Employee_Number))
  126. m.EMPLID
  127. else
  128. if(checkForGPIU(m.GPI_Legacy_Employee_Number)=="true")
  129. stripGPIU(m.GPI_Legacy_Employee_Number)
  130. else
  131. m.GPI_Legacy_Employee_Number, /* Logic */
  132. FIRST_NAME: m.FIRST_NAME,
  133. MIDDLE_NAME: m.MIDDLE_NAME,
  134. LAST_NAME: m.LAST_NAME,
  135. PREFERRED_NAME: m.PREF_FIRST_NAME,
  136. COMPANY: m.COMPANY,
  137. JOB_TITLE: m.JOBTITLE,
  138. ORGANIZATION_NAME: m.Organization_Name,
  139. LOCATION_CITY: m.Home_Address_City ,
  140. LOCATION_STATE: m.Home_Address_State,
  141. STORE_KEY: m.ASC_STORE_NBR,
  142. SUPERVISOR_NAME: m.MANAGER_NAME,
  143. SUPERVISOR_ID: m.MANAGER_ID, /* todo: Check */
  144. ASSIGNMENT_CATEGORY: m.FULL_PART_TIME, /* Logic change in june 27th */
  145. HIRE_DATE: m.HIRE_DT,
  146. TERM_DATE: m.TERMINATION_DT,
  147. COUNTRY: m.HOME_COUNTRY,
  148. HR_BUSINESS_UNIT: m.BUSINESS_UNIT, /* BLANK */
  149. HR_DIVISION: m.ASC_DIVISION, /* BLANK */
  150. HR_DEPARTMENT: m.DEPTNAME, /* BLANK */
  151. HR_DIRECTOR: m.HR_Director, /* BLANK */
  152. LEADERSHIP: m.MANAGER_LEVEL,
  153. PERSON_TYPE: if(activeEmployeesArray contains m.EMPL_STATUS)
  154. if(m.PER_ORG == "EMP")
  155. 'Employee'
  156. else
  157. 'CWK'
  158. else if (exEmployeeArray contains m.EMPL_STATUS)
  159. if(m.PER_ORG == "EMP")
  160. 'Ex-Employee'
  161. else
  162. 'Ex-CWK'
  163. else
  164. '', /* Logic */
  165. HR_MANAGER: m.HR_Manager,
  166. AAP_EMPLOYEE_ID: m.EMPLID
  167. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement