Input collection: myTrucks5
Year | Make | Model | Mileage |
2020 | Ford | F150 | 12343 |
2018 | Chevy | Silverado | 170567 |
2020 | Ford | F150 | 98765 |
2017 | Nissan | Frontier | 123975 |
2016 | GM | Yukon | 98753 |
Output collection: mySolution5
Result |
Make |
Mileage |
Model |
Year |
Solution code:
//Create a collection
ClearCollect(myTrucks5,
{Year: 2020, Make: "Ford", Model: "F150", Mileage: 12343},
{Year: 2018, Make: "Chevy", Model: "Silverado", Mileage: 170567},
{Year: 2020, Make: "Ford", Model: "F150", Mileage: 98765},
{Year: 2017, Make: "Nissan", Model: "Frontier", Mileage: 123975},
{Year: 2016, Make: "GM", Model: "Yukon", Mileage: 98753}
);
// Get column names
Set(
myJSON,
Distinct(
Ungroup(
MatchAll(
JSON(
myTrucks2,
JSONFormat.IgnoreBinaryData
),
"([^""]+?)""\s*:"
).SubMatches,
"SubMatches"
),
Value
)
)