Say you have an array of data like so
[
{
"Value": 300,
"Qty": 1,
"Notes": "Membership application. Level: PSA Member",
"OrderDetailType": "MemberLevel",
"Taxes": null,
"__IMTINDEX__": 1,
"__IMTLENGTH__": 2
},
{
"Value": 500,
"Qty": 1,
"Notes": "Extras: One-Time Initiation Fee - $500",
"OrderDetailType": "ExtraCost",
"Taxes": null,
"__IMTINDEX__": 2,
"__IMTLENGTH__": 2
}
]
This array comes as an output bundle for an intederminate set of operations – the Notes and Value keys are the key fields in question.
I’d like to create a spreadsheet where the Notes text become a column and the Value is added as a row under the appropriate column of data (related to the Notes of the bundle of course)
There will be other operations though that will continue to get new Notes fields or repeat existing ones and I want the value to go into a new row under the correct column. If new data is reached in Notes in a subsequent operation I’d like a new column to be created.
Here’s another operation through the execution of the scenario with a different output bundle in terms of Notes and Value
[
{
"Value": 300,
"Qty": 1,
"Notes": "Membership renewal. Level: PSA Member. Renew to 11/01/2024",
"OrderDetailType": "MemberLevel",
"Taxes": null,
"__IMTINDEX__": 1,
"__IMTLENGTH__": 1
}
]
and another
[
{
"Value": 150,
"Qty": 1,
"Notes": "Membership renewal. Level: PSA Member. Renew to 11/01/2024",
"OrderDetailType": "MemberLevel",
"Taxes": null,
"__IMTINDEX__": 1,
"__IMTLENGTH__": 1
}
]
and another
[
{
"Value": 200,
"Qty": 1,
"Notes": "Another Notes",
"OrderDetailType": "MemberLevel",
"Taxes": null,
"__IMTINDEX__": 1,
"__IMTLENGTH__": 1
}
]
The end result is a table that would look like this. The notes generate the header dynamically, and each array in each output bundle is generated in the right columns. Each row is another bundle.
Membership application. Level: PSA Member | Extras: One-Time Initiation Fee - $500 | Membership renewal. Level: PSA Member. Renew to 11/01/2024 | Another Notes |
---|---|---|---|
300 | 500 | ||
300 | |||
150 | |||
200 |
This sort of transformation is a bit like a pivot table, I guess. Anyone do this?