79648076

Date: 2025-06-02 01:11:10
Score: 0.5
Natty:
Report link
%dw 2.0
output application/json
---
{
  data: payload groupBy $.EMP_ID pluck ((value, key) -> {
    empID: value[0].EMP_ID,
    jobData: value groupBy ($.EMP_ID ++ '|' ++ $.DEPT_ID ++ '|' ++ $.OPRT_UNIT_CODE ++ '|' ++ $.PROD_CODE) pluck ((subValue, subKey) -> {
      DEPT_ID: subValue[0].DEPT_ID, 
      OPRT_UNIT_CODE: subValue[0].OPRT_UNIT_CODE,
      PROD_CODE: subValue[0].PROD_CODE,
      orgData: subValue map ((item, index) -> {
        OrgCode: item.NODE_CODE,
        AllocPct: item.ALLOC_PCT
      })
    })
  })
}
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Mahari