Hello all,
I can’t seem to understand the problem I am stuck on. I have a body of data that I am exporting from a PowerBI report into a Google Sheet. It is coming into Make as individual bundles of each row.
[
["Asset_Name","Asset_SC","2025-01-01","2025-01-02","2025-01-03"],
["AssetA", "SC-001", 10, 12, 15 ],
["AssetB", "SC-002", 20, 18, 22 ],
...
]
I aggregate an array from the bundles and slice it up into 2 different arrays in a variable module; header rows, and data rows. Here is where I am stuck.
My goal is to produce an array of assets, each with a sub-array of dates and the instance count the asset was played on said date. Something like this:
[
{
"Asset_Name": "AssetA",
"Asset_SC": "SC-001",
"Dates": [
{ "date": "2025-01-01", "value": 10 },
{ "date": "2025-01-02", "value": 12 },
...
]
},
{
"Asset_Name": "AssetB",
"Asset_SC": "SC-002",
"Dates": [
{ "date": "2025-01-01", "value": 20 },
{ "date": "2025-01-02", "value": 18 },
...
]
},
...
]
To accomplish this, I was trying to iterate the DataRows array based on the index of a repeater set to repeat as many times as the array is long.
I was trying to map the the sub-array and related object all together in a JSON structure and then I would aggregate it all together into the final structure so I can automate the creation of thousands of reporting cue sheets from templates:
I keep throwing errors every time I try to rethink my expression and I can feel I am just slightly off in my approach. I am just getting into working with arrays in Make and any direction would be appreciated.