Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I am trying to extract multiple row from a JSON tRESTClient input with some static data inject in the row creation. My JSON input look like so:
[
{
"OrderID": 6675,
"FirstName": "John",
"LastName": "Doe",
"Address": "123 spring st",
"OrderItemList": [
{
"ItemID": "736940759",
"ItemQty": 1,
"ItemDesc": "Widget One",
"ItemUnitPrice": 68.99,
},
{
"ItemID": "736940858",
"ItemQty": 1,
"ItemDesc": "Widget Two",
"ItemUnitPrice": 37.99,
}
],
"PromotionList": [
{
"PromotionName": "Code",
"Coupon": "Code",
"DiscountAmount": 9.6
}
]
I am trying to get the following out put
OrderID | FirstName | LastName | Address | Coupon | ItemID | ItemQty | ItemDesc | ItemUnitPrice |
6675 | John | Doe | 123 spring st | Code | 736940759 | 1 | Fine Product | 68.99 |
6675 | John | Doe | 123 spring st | Code | 736940858 | 1 | Good Product | 37.99 |
6675 | John | Doe | 123 spring st | Code | 77777 | 1 | Discount | -9.6 |
I have been pulling my hair out, any help would be greatly appreciated.
Regards,
Joseph
Hi,
Please read json file as input like below
Then use tMap to split records into two pipelines like below
Then use tAggregate to get unique order for each coupon.
Then load aggregate and tMap output to tBufferout.
Use tBufferinput to read two sets of data and load into table/File.
Regards,
Thank you so much for the solution. I am new to Talend and would have never been able to figure this out on my own. I still however have one problem. I can't seem to figure out how to transform the DiscountAmount into a negative number. I keep on getting a compiling error "Detail Message: Type mismatch: cannot convert from Double to String". Any tip on how to resolve it?
Thank you again and regards,
Joseph