web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / GroupBy and JSON funct...
Power Apps
Answered

GroupBy and JSON functions

(1) ShareShare
ReportReport
Posted on by 45

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?

Categories:
I have the same question (0)
  • Kristian_Cole Profile Picture
    195 on at

    I used this quite recently, answer was from another thread:

     

    "

    Create a flow like this:

    Kristian_Cole_0-1701714126675.png

     

     

    Then, in PowerApps use a ClearCollect(colName, FlowName.Run("JSON Data you want to convert to a collection"))

    "

     

    hope this helps!!

  • MarkBaker Profile Picture
    45 on at

    Thank you for your reply. My problem is creating the collection. How do I create the collection? My code has errors.  

  • Kristian_Cole Profile Picture
    195 on at

    Have you tried creating a flow with the parse json function, copy your json into it, run your output should highlight the errors. 

  • Verified answer
    MarkBaker Profile Picture
    45 on at

    At that point in time I didn't have any json to send to Power Automate. I was having issues with creating the Collection. 

    I got it to work with this and no power automate needed.

    ClearCollect(
     ResultCollection,
     ForAll(
     'CCDD Dump Approvals',
     {
     CCDDJobName: LookUp(
     CCDDjobs,
     'Job ID' = 'CCDD Dump Approvals'[@'Job ID']
     ).Address,
     MaterialSiteName: LookUp(
     'Material Sites',
     ID = 'CCDD Dump Approvals'[@'Material Site ID']
     ).Name,
     DumpCode: 'CCDD Dump Approvals'[@'Dump Code'],
     Quantity: 'CCDD Dump Approvals'[@Quanity],
     Notes: 'CCDD Dump Approvals'[@Notes],
     EndDate: DateValue('CCDD Dump Approvals'[@'End Date'])
     }
     )
    );
    ClearCollect(
     GroupedResultCollection,
     GroupBy(
     ResultCollection,
     "CCDDJobName",
     "GroupedRecord"
     )
    );
    Set(
     CCDDReport,
     JSON(GroupedResultCollection)
    );

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 1,033

#2
Valantis Profile Picture

Valantis 632

#3
11manish Profile Picture

11manish 607

Last 30 days Overall leaderboard