Hello!
I'm trying to group my SQL export records by Purchase Order Number and move the shared/common fields to a header level to reduce redundancy for import into NS.
Original Query Output (Before Grouping)
Before grouping by PO Number, my SQL query returns individual records like this:
json
{
"page_of_records": [
{
"rows": [
{
"ReceiptID": 101,
"VendorID": 500,
"NetSuiteVendorInternalID": 1500,
"NSLocationInternalID": 25,
"NetSuiteLocationName": null,
"NetSuiteLocationID": null,
"PurchaseOrderNumber": "PO1234",
"PurchaseOrderInternalID": null,
"InventoryID": 80001,
"NetSuiteItemID": 20001,
"ProductName": "Test Product Kit A",
"LotNumber": "LOT001",
"ReceivedDate": "2025-06-01T00:00:00.000Z",
"QuantityRaw": 50,
"PackSize": 25,
"QuantityNormalized": 2,
"CoupaIRLineID": null,
"CoupaPOLineID": null,
"Memo": null,
"RecordStatus": "Pending",
"RecordStatusDate": "2025-06-08T10:15:30.000Z",
"RecordError": null,
"PackNumber": 1
},
{
"ReceiptID": 102,
"VendorID": 500,
"NetSuiteVendorInternalID": 1500,
"NSLocationInternalID": 25,
"NetSuiteLocationName": null,
"NetSuiteLocationID": null,
"PurchaseOrderNumber": "PO1234",
"PurchaseOrderInternalID": null,
"InventoryID": 80001,
"NetSuiteItemID": 20001,
"ProductName": "Test Product Kit A",
"LotNumber": "LOT001",
"ReceivedDate": "2025-06-01T00:00:00.000Z",
"QuantityRaw": 50,
"PackSize": 25,
"QuantityNormalized": 2,
"CoupaIRLineID": null,
"CoupaPOLineID": null,
"Memo": null,
"RecordStatus": "Pending",
"RecordStatusDate": "2025-06-08T10:15:30.000Z",
"RecordError": null,
"PackNumber": 2
},
{
"ReceiptID": 103,
"VendorID": 500,
"NetSuiteVendorInternalID": 1500,
"NSLocationInternalID": 25,
"NetSuiteLocationName": null,
"NetSuiteLocationID": null,
"PurchaseOrderNumber": "PO1234",
"PurchaseOrderInternalID": null,
"InventoryID": 80001,
"NetSuiteItemID": 20001,
"ProductName": "Test Product Kit A",
"LotNumber": "LOT001",
"ReceivedDate": "2025-06-01T00:00:00.000Z",
"QuantityRaw": 50,
"PackSize": 25,
"QuantityNormalized": 2,
"CoupaIRLineID": null,
"CoupaPOLineID": null,
"Memo": null,
"RecordStatus": "Pending",
"RecordStatusDate": "2025-06-08T10:15:30.000Z",
"RecordError": null,
"PackNumber": 3
}
]
}
]
}
Current Grouped Output
After using Celigo to group by PO Number, I'm actually getting this structure where the records are still separate but I haven't successfully moved the shared fields to header level yet:
json
{
"page_of_records": [
{
"rows": [
{
"ReceiptID": 101,
"VendorID": 500,
"NetSuiteVendorInternalID": 1500,
"NSLocationInternalID": 25,
"NetSuiteLocationName": null,
"NetSuiteLocationID": null,
"PurchaseOrderNumber": "PO1234",
"PurchaseOrderInternalID": null,
"InventoryID": 80001,
"NetSuiteItemID": 20001,
"ProductName": "Test Product Kit A",
"LotNumber": "LOT001",
"ReceivedDate": "2025-06-01T00:00:00.000Z",
"QuantityRaw": 50,
"PackSize": 25,
"QuantityNormalized": 2,
"CoupaIRLineID": null,
"CoupaPOLineID": null,
"Memo": null,
"RecordStatus": "Pending",
"RecordStatusDate": "2025-06-08T10:15:30.000Z",
"RecordError": null,
"PackNumber": 1
},
{
"ReceiptID": 102,
"VendorID": 500,
"NetSuiteVendorInternalID": 1500,
"NSLocationInternalID": 25,
"NetSuiteLocationName": null,
"NetSuiteLocationID": null,
"PurchaseOrderNumber": "PO1234",
"PurchaseOrderInternalID": null,
"InventoryID": 80001,
"NetSuiteItemID": 20001,
"ProductName": "Test Product Kit A",
"LotNumber": "LOT001",
"ReceivedDate": "2025-06-01T00:00:00.000Z",
"QuantityRaw": 50,
"PackSize": 25,
"QuantityNormalized": 2,
"CoupaIRLineID": null,
"CoupaPOLineID": null,
"Memo": null,
"RecordStatus": "Pending",
"RecordStatusDate": "2025-06-08T10:15:30.000Z",
"RecordError": null,
"PackNumber": 2
},
{
"ReceiptID": 103,
"VendorID": 500,
"NetSuiteVendorInternalID": 1500,
"NSLocationInternalID": 25,
"NetSuiteLocationName": null,
"NetSuiteLocationID": null,
"PurchaseOrderNumber": "PO1234",
"PurchaseOrderInternalID": null,
"InventoryID": 80001,
"NetSuiteItemID": 20001,
"ProductName": "Test Product Kit A",
"LotNumber": "LOT001",
"ReceivedDate": "2025-06-01T00:00:00.000Z",
"QuantityRaw": 50,
"PackSize": 25,
"QuantityNormalized": 2,
"CoupaIRLineID": null,
"CoupaPOLineID": null,
"Memo": null,
"RecordStatus": "Pending",
"RecordStatusDate": "2025-06-08T10:15:30.000Z",
"RecordError": null,
"PackNumber": 3
}
]
}
]
}
Desired Final Output
I want the rows
field to be parsed as an actual JSON array instead of a string:
json
{
"page_of_records": [
{
"rows": [
{
"PurchaseOrderNumber": "PO1234",
"VendorID": 500,
"NetSuiteVendorInternalID": 1500,
"NSLocationInternalID": 25,
"NetSuiteLocationName": null,
"NetSuiteLocationID": null,
"PurchaseOrderInternalID": null,
"rows": [
{
"ReceiptID": 101,
"InventoryID": 80001,
"NetSuiteItemID": 20001,
"ProductName": "Test Product Kit A",
"LotNumber": "LOT001",
"ReceivedDate": "2025-06-01",
"QuantityRaw": 50,
"PackSize": 25,
"QuantityNormalized": 2,
"CoupaIRLineID": null,
"CoupaPOLineID": null,
"Memo": null,
"RecordStatus": "Pending",
"RecordStatusDate": "2025-06-08T10:15:30.000",
"RecordError": null,
"PackNumber": 1
},
{
"ReceiptID": 102,
"InventoryID": 80001,
"NetSuiteItemID": 20001,
"ProductName": "Test Product Kit A",
"LotNumber": "LOT001",
"ReceivedDate": "2025-06-01",
"QuantityRaw": 50,
"PackSize": 25,
"QuantityNormalized": 2,
"CoupaIRLineID": null,
"CoupaPOLineID": null,
"Memo": null,
"RecordStatus": "Pending",
"RecordStatusDate": "2025-06-08T10:15:30.000",
"RecordError": null,
"PackNumber": 2
},
{
"ReceiptID": 103,
"InventoryID": 80001,
"NetSuiteItemID": 20001,
"ProductName": "Test Product Kit A",
"LotNumber": "LOT001",
"ReceivedDate": "2025-06-01",
"QuantityRaw": 50,
"PackSize": 25,
"QuantityNormalized": 2,
"CoupaIRLineID": null,
"CoupaPOLineID": null,
"Memo": null,
"RecordStatus": "Pending",
"RecordStatusDate": "2025-06-08T10:15:30.000",
"RecordError": null,
"PackNumber": 3
}
]
}
]
}
]
}
Question
Is it possible to somehow add a transformation step to parse the JSON string in the PO's rows
field into an actual JSON array? I need this to work with any number of receipt records per purchase order.
The goal is to eliminate the redundant shared fields (VendorID, PurchaseOrderNumber, etc.) that were repeated in every record, while making the receipt details easily accessible as a proper array.
Thanks for any help!