I'm trying to migrate from Dataweave 1.0 to 2.0 and please don't consider the variable in that given DWL. I'm facing the following error:
Unable to resolve reference of zeroPad2.
Unable to call `map` with (`Any`, ($, $$) -> `?`):
-
55| payload.DTOApplication.*DTOLossHistory[?($.@StatusCd == "Active")] default [] orderBy -($.@LossDt) map using (dispIdx = zeroPad2($$+1)) {
^^^^^^^^
- Unable to resolve reference of zeroPad2.
Actual: `map(items: `Array<T>`, mapper: (item: `T`, index: `Number`) -> `R`) -> `Array<R>``
-
55| payload.DTOApplication.*DTOLossHistory[?($.@StatusCd == "Active")] default [] orderBy -($.@LossDt) map using (dispIdx = zeroPad2($$+1)) {
^^^^^^^^
- Unable to resolve reference of zeroPad2.
Actual: `map(value: `Null`, mapper: (item: `Nothing`, index: `Nothing`) -> `Any`) -> `Null``
Dataweave 1.0 : https://github.com/Manikandan99/Map_request/blob/main/Dataweave_1.0_Mule_3.dwl
I could able to migrate the all the values except from at line 54:
(
payload.DTOApplication.*DTOLossHistory[?($.@StatusCd == "Active")] default [] orderBy -($.@LossDt) map using (dispIdx = zeroPad2($$+1)) {
'CauseOfLoss$dispIdx': $.@LossCauseCd,
'DateOfLoss$dispIdx': $.@LossDt,
'IncurredAmt$dispIdx': $.@TotalIncurred
}
)
I'm try to dataweave migration: https://github.com/Manikandan99/Map_request/blob/main/Dataweave_2.0_mule_4.dwl
Actual payload : https://github.com/Manikandan99/Map_request/blob/main/input_xml_request_for_transformation.xml
Any ideas please on how to migrate the given dataweave 1.0 to 2.0?