I'm trying to pass some json to power automate.
I want to group jobs by the column cr213_job and then inside list the dump details
I have a button with the on select property set to: (not getting desired output)
ClearCollect(
GroupedData,
GroupBy('CCDD Dump Approvals', "cr213_job", "GroupedRecords")
);
ClearCollect(
GroupedDataDetails,
ForAll(
GroupedData,
{
'job': cr213_job,
'DumpApprovals': Concatenate(
"[",
Concatenate(
Filter('CCDD Dump Approvals', "cr213_job" = "job"),
JSON(
{
'name': 'Dump Site',
'code': 'Dump Code',
'notes': 'Notes',
'quanity': 'Quantity',
'enddate': 'End Date'
}
),
If(job<> Last(GroupedData).job, ",", "")
),
"]"
)
}
)
);
GroupedDataDetails
this is my desired output:
[
{"approvals": [
{
"job": "",
"dumpsites": [
{
"name": "",
"code": "",
"quanity": "",
"notes": "",
"enddate": ""
}
]
},
{
"job": "",
"dumpsites": [
{
"name": "",
"code": "",
"quanity": "",
"notes": "",
"enddate": ""
},
{
"name": "",
"code": "",
"quanity": "",
"notes": "",
"enddate": ""
}
]
}
]
}
How can I do this?