I'm attempting to group Quote Lines in the JSON output of a DataRaptor Extract with a Transform and am unsure if this is possible without an Integration Procedure.
I currently have Quote Lines outputting as such:
"QuoteLine": [
{
"ProductSiteName": "BO1",
"ProductId": "Prod1",
"Quantity": 1,
"Number": 1,
"Quote": "a5LQL0000001k8r2AA"
},
{
"ProductSiteName: "S0-1",
"ProductId": "Prod2",
"Quantity": 15,
"Number": 2,
"Quote": "a5LQL0000001k8r2AA"
} ...
and would like to transform that to group based on the ProductSiteName as such:
"Site" : [
{
"ProductSiteName": "BO1"
"QuoteLine": [
{
"ProductId": "Prod1",
"Quantity": 1,
"Number": 1,
"Quote": "a5LQL0000001k8r2AA"
}
},
{
"ProductSiteName": "S0-1",
"QuoteLine": [
{
"ProductId": "Prod2",
"Quantity": 15,
"Number": 2,
"Quote": "a5LQL0000001k8r2AA"
}
} ...
I'm relatively new to OmniScripts and feel like I might be already incorrect at the Extract level.
Best Answer
You will need to use an Integration Procedure to accomplish the required transformation.
High level steps are:
ProductSiteName
.This can be done by passing in the
Quoteline
list to the DR Transform, using the formulaLISTMERGE("ProductSiteName",LIST(%QuoteLine%))
to "extract" the uniqueProductSiteName
values and then let the DR Transform return a list of all the uniqueProductSiteName
values:The output will look like:
Loop over these values using a Loop Block:
ProductSiteName
value as well as the list of Quote LinesProductSiteName
ProductSiteName
in the required format:Good luck!