0% found this document useful (0 votes)
9 views

Dataweave Real Time Tasks

Dataweave Real Time Tasks

Uploaded by

deviprasad5083
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Dataweave Real Time Tasks

Dataweave Real Time Tasks

Uploaded by

deviprasad5083
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

9876547890

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",

"address1": "22 test dr",

"address2": "as",

"city": "DANSVILLE",

"postal Code": "14437",

"StateOrProvince": "NY",

"Country": "US",

"email": "[email protected]"

}
}

}
======================================
==========
======

We only want the output when type is WE

Expected output

"PARTNERADDRESSES": [

"ADDR_NO": "001",

"NAME": "David",

"NAME_2": "Jones",

"E_MAIL": "[email protected]",

"STREET": "22 test dras",


"CITY": "DANSVILLE",

"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:

(payload.Value filter $.status !=null)[-1]

================>>>>>>>>>>>>>>>>>>>>>

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:

var partNo= payload map (value,key ) ->


{
partNumber: value.partNumber
}
output application/json
---
{
"apiKey": "abcde",
"customerID": payload.customerID[0],
"distributorID": payload.distributorID[0],
"items": flatten(partNo).partNumber
}

============================>>>>>>>>>
>>>>>>>

You might also like