Dataweave Real Time Tasks
Dataweave Real Time Tasks
1.
{
"Order": {
"orderId": "100020",
"buyerRefNumber": "abc",
"orderDate": "2021-10-19",
"docType": "APP",
"orderType": "TA",
"salesOrg": "1000",
"distributionChannel": "01",
"division": "00",
"currency": "USD",
"ShippingCondition": "90",
"priority": "",
"notes": "1970-12-10",
"LineItem": [
"itemId": "000001",
"quantity": "1",
"Product": {
"id": "RPM-BP100"
},
"itemId": "000002",
"quantity": "1",
"Product": {
"id": "FRT"
],
"Addresses": {
"Address": [
"type": "AG",
"id": "0010803001"
},
"type": "WE",
"id": "0010101003",
"link": "001",
"firstName": "David",
"lastName": "Jones",
"address2": "as",
"city": "DANSVILLE",
"StateOrProvince": "NY",
"Country": "US",
"email": "[email protected]"
}
}
}
======================================
==========
======
Expected output
"PARTNERADDRESSES": [
"ADDR_NO": "001",
"NAME": "David",
"NAME_2": "Jones",
"E_MAIL": "[email protected]",
"POSTL_CODE": "14437",
"REGION": "NY",
"COUNTRY": "US"
logic:
{
"PARTNERADDRESSES":
(payload.Order.Addresses.Address filter $."type"
== "WE") map
{
"ADDR_NO": $.link,
"NAME": $.firstName,
"NAME_2": $.lastName,
"E_MAIL": $.email,
"STREET":$.address1 ++ $.address2,
"CITY": $.city,
"POSTL_CODE": $.postalCode,
"REGION": $.stateOrProvince,
"COUNTRY": $.country
}
}
================>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>
2. I have this below json I want to retrieve the
previous element of "status": null
{
"Value":[{
"status": "success",
"id": 1,
"employee_name": "Tiger Nixon",
"employee_salary": 100000,
"employee_age": 35
},
{
"status": "success",
"id": 1,
"employee_name": "Tiger Nixon",
"employee_salary": 10000,
"employee_age": 55
},
{
"status": null,
"id": 1,
"employee_name": "Tiger Nixon",
"employee_salary": 23000,
"employee_age": 35
}
]
}
logic:
================>>>>>>>>>>>>>>>>>>>>>
3.
"partNumber": "UU1008030",
"customerID": "60092580",
"distributorID": "60937242"
},
"partNumber": "A40P30",
"customerID": "60092580",
"distributorID": "60937242"
},
{
"partNumber": "UU1008033",
"customerID": "60092581",
"distributorID": "60937241"
},
"partNumber": "A40P34",
"customerID": "60092581",
"distributorID": "60937241"
expected output:
{
"apiKey": "abcde",
"customerID": "60092580",
"distributorID": "60937242",
"items":{
"partNumber": [
"UU1008030",
"A40P30"
LOGIC:
============================>>>>>>>>>
>>>>>>>