Created 03-24-2022 04:33 AM
I have an issue with my JOLT transformation in NIFI:
My INPUT:
{
"customerNumber": "40890036",
"customerOrderNumber": "TPACSAY4",
"orderType": "ES",
"orderEntryFlag": "createOrder",
"parts": [
{
"partNumberOrdered": "A0029864271",
"quantityOrdered": "2.00",
"customerInfo": "Cust information",
"chassisNo": "WDB45678901234567",
"additionalEntry": "ADDITIONAL ENTRY"
},
{
"partNumberOrdered": "N000000001388",
"quantityOrdered": "10.00",
"customerInfo": "Cust information",
"chassisNo": "WDB45678901234567",
"additionalEntry": "ADDITIONAL ENTRY"
}
]
}
My current JOLT is below:
[
{
"operation": "modify-default-beta",
"spec": {
"CustNo1": "${CustNO}",
"Customer": "${CustNO}",
"ShippingSiteId": "0",
"SalesOrderOriginCode": "CFE",
"ShippingWarehouseId": "5559",
"LineDiscount": "${MCRHoldCode}",
"SALESORDERNUMBER": "",
"customerReqNo": "",
"OrderType": "${MCRHoldCode}",
"DELIVERYTERMSCODE": "${DELIVERYTERMSCODE}",
"ShippingDate_VO_Header": "=substring((${ShippingDate_VO}), 0, 20)",
"ShippingDate_EM_Header": "=substring((${ShippingDate_EM}), 0, 20)",
"ShippingDate_ES_Header": "=substring((${ShippingDate_ES}), 0, 20)",
"parts": {
"*": {
"DMLRCreationDateTime": "=concat(${currentDate},'+00:00')",
"Position number": "",
"Manual_or_Auto": "",
"QtyProPosed": "",
"INVENTORYLOTID": "",
"chassisNo": "",
"customerInfo": "",
"additionalEntry": "",
"ShippingDate_VO": "=substring((${ShippingDate_VO}), 0, 20)",
"ShippingDate_EM": "=substring((${ShippingDate_EM}), 0, 20)",
"ShippingDate_ES": "=substring((${ShippingDate_ES}), 0, 20)"
}
}
}
},
{
"operation": "modify-default-beta",
"spec": {
"parts": {
"*": {
"REQUESTEDSHIPPINGDATE_New": "=concat(@(1,ShippingDate_VO), @(1,ShippingDate_EM),@(1,ShippingDate_ES))"
}
}
}
},
{
"operation": "modify-default-beta",
"spec": {
"parts": {
"*": {
"REQUESTEDSHIPPINGDATE_Final": "=substring(@(1,REQUESTEDSHIPPINGDATE_New), 1, 20)"
}
}
}
},
{
"operation": "shift",
"spec": {
"SALESORDERNUMBER": "SALESORDERHEADERV2ENTITY.SALESORDERNUMBER",
"customerOrderNumber": "SALESORDERHEADERV2ENTITY.CUSTOMERSORDERREFERENCE",
"Customer": "SALESORDERHEADERV2ENTITY.ORDERINGCUSTOMERACCOUNTNUMBER",
"customerReqNo": "SALESORDERHEADERV2ENTITY.CUSTOMERREQUISITIONNUMBER",
"ShippingSiteId": "SALESORDERHEADERV2ENTITY.DEFAULTSHIPPINGSITEID",
"ShippingWarehouseId": "SALESORDERHEADERV2ENTITY.DEFAULTSHIPPINGWAREHOUSEID",
"orderType": "SALESORDERHEADERV2ENTITY.SALESORDERPOOLID",
"OrderType": {
"CH": {
"#SD": "SALESORDERHEADERV2ENTITY.SMS_MCRHOLDCODE"
},
"ZZ": {
"#SD": "SALESORDERHEADERV2ENTITY.SMS_MCRHOLDCODE"
},
"*": {
"# ": "SALESORDERHEADERV2ENTITY.SMS_MCRHOLDCODE"
}
},
"DELIVERYTERMSCODE": {
"ES": {
"#CIF": "SALESORDERHEADERV2ENTITY.DELIVERYTERMSCODE"
},
"EM": {
"#CIF": "SALESORDERHEADERV2ENTITY.DELIVERYTERMSCODE"
},
"*": {
"# ": "SALESORDERHEADERV2ENTITY.DELIVERYTERMSCODE"
}
},
"LineDiscount": "SALESORDERHEADERV2ENTITY.LINEDISCOUNTCUSTOMERGROUPCODE",
"parts": {
"0": {
"partNumberOrdered": "SALESORDERHEADERV2ENTITY.SALESORDERLINEV2ENTITY[&1].ITEMNUMBER",
"quantityOrdered": "SALESORDERHEADERV2ENTITY.SALESORDERLINEV2ENTITY[&1].ORDEREDSALESQUANTITY",
"additionalEntry": "SALESORDERHEADERV2ENTITY.SALESORDERLINEV2ENTITY[&1].SMS_ADDITIONALINFORMATION",
"chassisNo": "SALESORDERHEADERV2ENTITY.SALESORDERLINEV2ENTITY[&1].SMS_VINNUMBER",
"INVENTORYLOTID": "SALESORDERHEADERV2ENTITY.SALESORDERLINEV2ENTITY[&1].INVENTORYLOTID",
"Position number": "SALESORDERHEADERV2ENTITY.SALESORDERLINEV2ENTITY[&1].CUSTOMERSLINENUMBER",
"DMLRCreationDateTime": "SALESORDERHEADERV2ENTITY.SALESORDERLINEV2ENTITY[&1].SMS_CREATEDDATEANDTIME",
"Manual_or_Auto": "SALESORDERHEADERV2ENTITY.SALESORDERLINEV2ENTITY[&1].SMS_MANUALORADDITIONAL",
"QtyProPosed": "SALESORDERHEADERV2ENTITY.SALESORDERLINEV2ENTITY[&1].SMS_QUANTITYPROPOSED",
"customerInfo": "SALESORDERHEADERV2ENTITY.SALESORDERLINEV2ENTITY[&1].CUSTOMERREQUISITIONNUMBER",
"REQUESTEDSHIPPINGDATE_Final": "SALESORDERHEADERV2ENTITY.SALESORDERLINEV2ENTITY[&1].REQUESTEDSHIPPINGDATE"
},
"*": {
"partNumberOrdered": "SALESORDERHEADERV2ENTITY.SALESORDERLINEV2ENTITY[&1].ITEMNUMBER",
"quantityOrdered": "SALESORDERHEADERV2ENTITY.SALESORDERLINEV2ENTITY[&1].ORDEREDSALESQUANTITY",
"additionalEntry": "SALESORDERHEADERV2ENTITY.SALESORDERLINEV2ENTITY[&1].SMS_ADDITIONALINFORMATION",
"chassisNo": "SALESORDERHEADERV2ENTITY.SALESORDERLINEV2ENTITY[&1].SMS_VINNUMBER",
"INVENTORYLOTID": "SALESORDERHEADERV2ENTITY.SALESORDERLINEV2ENTITY[&1].INVENTORYLOTID",
"Position number": "SALESORDERHEADERV2ENTITY.SALESORDERLINEV2ENTITY[&1].CUSTOMERSLINENUMBER",
"DMLRCreationDateTime": "SALESORDERHEADERV2ENTITY.SALESORDERLINEV2ENTITY[&1].SMS_CREATEDDATEANDTIME",
"Manual_or_Auto": "SALESORDERHEADERV2ENTITY.SALESORDERLINEV2ENTITY[&1].SMS_MANUALORADDITIONAL",
"QtyProPosed": "SALESORDERHEADERV2ENTITY.SALESORDERLINEV2ENTITY[&1].SMS_QUANTITYPROPOSED",
"customerInfo": "SALESORDERHEADERV2ENTITY.SALESORDERLINEV2ENTITY[&1].CUSTOMERREQUISITIONNUMBER",
"REQUESTEDSHIPPINGDATE_Final": "SALESORDERHEADERV2ENTITY.SALESORDERLINEV2ENTITY[&1].REQUESTEDSHIPPINGDATE"
}
}
}
}
]
The output is:
{
"SALESORDERHEADERV2ENTITY" : {
"SALESORDERNUMBER" : "",
"CUSTOMERSORDERREFERENCE" : "TPACSAY4",
"ORDERINGCUSTOMERACCOUNTNUMBER" : "${CustNO}",
"CUSTOMERREQUISITIONNUMBER" : "",
"DEFAULTSHIPPINGSITEID" : "0",
"DEFAULTSHIPPINGWAREHOUSEID" : "5559",
"SALESORDERPOOLID" : "ES",
"SMS_MCRHOLDCODE" : " ",
"DELIVERYTERMSCODE" : " ",
"LINEDISCOUNTCUSTOMERGROUPCODE" : "${MCRHoldCode}",
"SALESORDERLINEV2ENTITY" : [ {
"ITEMNUMBER" : "A0029864271",
"ORDEREDSALESQUANTITY" : "2.00",
"SMS_ADDITIONALINFORMATION" : "ADDITIONAL ENTRY",
"SMS_VINNUMBER" : "WDB45678901234567",
"INVENTORYLOTID" : "",
"CUSTOMERSLINENUMBER" : "",
"SMS_CREATEDDATEANDTIME" : "${currentDate}+00:00",
"SMS_MANUALORADDITIONAL" : "",
"SMS_QUANTITYPROPOSED" : "",
"CUSTOMERREQUISITIONNUMBER" : "Cust information",
"REQUESTEDSHIPPINGDATE" : "2022-03-25T15:26:55"
}, {
"ITEMNUMBER" : "N000000001388",
"ORDEREDSALESQUANTITY" : "10.00",
"SMS_ADDITIONALINFORMATION" : "ADDITIONAL ENTRY",
"SMS_VINNUMBER" : "WDB45678901234567",
"INVENTORYLOTID" : "",
"CUSTOMERSLINENUMBER" : "",
"SMS_CREATEDDATEANDTIME" : "${currentDate}+00:00",
"SMS_MANUALORADDITIONAL" : "",
"SMS_QUANTITYPROPOSED" : "",
"CUSTOMERREQUISITIONNUMBER" : "Cust information",
"REQUESTEDSHIPPINGDATE" : "2022-03-25T15:26:55"
} ]
}
}
My requirement:
I need to add the the field "REQUESTEDSHIPPINGDATE" : "2022-03-25T15:26:55", in the header also(just after the line marked in red).
Please help :
Created 03-24-2022 05:57 AM
Hi,
Got it. The below modification done and it is working fine. Thank you all
{
"operation": "modify-default-beta",
"spec": {
"REQUESTEDSHIPPINGDATE_H1": "=concat(@(1,ShippingDate_VO_Header), @(1,ShippingDate_EM_Header),@(1,ShippingDate_ES_Header))"
}
},
{
"operation": "modify-default-beta",
"spec": {
"REQUESTEDSHIPPINGDATE_Header": "=substring(@(1,REQUESTEDSHIPPINGDATE_H1), 1, 20)"
}
},
{
"operation": "shift",
"spec": {
"REQUESTEDSHIPPINGDATE_Header": "SALESORDERHEADERV2ENTITY.REQUESTEDSHIPPINGDATE_Header"
}
]
Created 03-24-2022 05:57 AM
Hi,
Got it. The below modification done and it is working fine. Thank you all
{
"operation": "modify-default-beta",
"spec": {
"REQUESTEDSHIPPINGDATE_H1": "=concat(@(1,ShippingDate_VO_Header), @(1,ShippingDate_EM_Header),@(1,ShippingDate_ES_Header))"
}
},
{
"operation": "modify-default-beta",
"spec": {
"REQUESTEDSHIPPINGDATE_Header": "=substring(@(1,REQUESTEDSHIPPINGDATE_H1), 1, 20)"
}
},
{
"operation": "shift",
"spec": {
"REQUESTEDSHIPPINGDATE_Header": "SALESORDERHEADERV2ENTITY.REQUESTEDSHIPPINGDATE_Header"
}
]
Created 03-24-2022 10:16 AM
I'm happy to see you resolved your issue. Please mark the appropriate reply as the solution, as it will make it easier for others to find the answer in the future.