Forum Discussion

Max's avatar
Max
New Contributor II
2 years ago

Data transformation issue

Hello,

I have a stored procedure that returns the following and i need that dataset transformed into the expected result. Thanks you for taking a look.

Stored procedure result/input:

 

[

  {

    "RiskLevelCode": "High",

    "RiskLevelName": "High Risk",

    "Low_Limit": 0.00,

    "High_Limit": 75.00

  },

  {

    "RiskLevelCode": "Med",

    "RiskLevelName": "Medium Risk",

    "Low_Limit": 75.10,

    "High_Limit": 85.00

  },

  {

    "RiskLevelCode": "Low",

    "RiskLevelName": "Low Risk",

    "Low_Limit": 85.10,

    "High_Limit": 1000.00

  }

]

Expected result:

 

"ranges":{

"highRiskLimitRange": "0-75",

"mediumRiskLimitRange": "75.10-85",

"lowRiskLimitRange": "85.10-1000"

}

1 Reply

  • Hello Max,

    You can try by grouping the documents together using Group By N with group size set to 0, then using the reduce function in a Mapper Snap on top of that array you can get the wanted output structure.

    For more details please refer to the attached pipeline and let me know if this helps you!

    Regards,

    Aleksandar.