Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]
Created 04-16-2024 12:59 PM
The feed json is like below:
[
{
"orderId": "10000",
"orderItems": [
{
"orderItemSeqId": "10001",
"productIdentifications": [
{
"productIdentificationTypeId": "SKU",
"idValue": "98706"
},
{
"productIdentificationTypeId": "UPCA",
"idValue": "98788"
},
{
"productIdentificationTypeId": "HS_CODE",
"idValue": "98790"
}
]
},
{
"orderItemSeqId": "10002",
"productIdentifications": [
{
"productIdentificationTypeId": "SKU",
"idValue": "98690"
},
{
"productIdentificationTypeId": "UPCA",
"idValue": "98698"
},
{
"productIdentificationTypeId": "HS_CODE",
"idValue": "98999"
}
]
}
]
}
]Requirement- Prepare two new fields for each item of an order.
1. Style: idValue of productIdentification whose productIdentificationTypeId is SKU.
2. UPC: idValue of productIdentification whose productIdentificationTypeId is UPCA.
The output json should be
[
{
"orderId": "10000",
"orderItems": [
{
"orderItemSeqId": "10001",
"productIdentifications": [
{
"productIdentificationTypeId": "SKU",
"idValue": "98706"
},
{
"productIdentificationTypeId": "UPCA",
"idValue": "98788"
},
{
"productIdentificationTypeId": "HS_CODE",
"idValue": "98790"
}
],
"Style": "98706",
"UPC": "98788"
},
{
"orderItemSeqId": "10002",
"productIdentifications": [
{
"productIdentificationTypeId": "SKU",
"idValue": "98690"
},
{
"productIdentificationTypeId": "UPCA",
"idValue": "98698"
},
{
"productIdentificationTypeId": "HS_CODE",
"idValue": "98999"
}
],
"Style": "98690",
"UPC": "98698"
}
]
}
]
Tried this property in UpdateRecord using RecordPath language but it didn't work.
name: "/orderItems[*]/Style"
value: "/orderItems[*]/goodIdentifications[./goodIdentificationTypeId='SKU']/idValue"
Created 04-16-2024 01:43 PM
@nidhipal Welcome to the Cloudera Community!
To help you get the best possible solution, I have tagged our NiFi experts @SAMSAL @joseomjr who may be able to assist you further.
Please keep us updated on your post, and we hope you find a satisfactory solution to your query.
Regards,
Diana Torres,Created 04-17-2024 03:23 AM
Hi @nidhipal
Looks like you figured this out here, https://community.cloudera.com/t5/Support-Questions/Possible-RecordPath-to-fetch-data-from-a-list-ba...
The added RecordPath works.
../goodIdentifications[*][./goodIdentificationTypeId = "SKU"]/idValue
Thank you!