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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Group nested gallery b...
Power Apps
Unanswered

Group nested gallery by foreign key relationship table column

(0) ShareShare
ReportReport
Posted on by 26

Hi, 

 

so I have a problem with grouping my nested gallery correctly within my application made using PowerApps for Teams.

Following scenario: 

 

I've got 2 tables: streams and activities.  

The streams only have a title column.

The activities have a title and a quarter number field (1 to 4).

Every gallery involved is a flexible height gallery.

There is one-to-many relationship configured between streams and activities.

 

- Within my top gallery, my items are set to:

  streams

 

- Inside the top gallery template, I've added another gallery (refered as nested gallery ongoing) and set the items to:

  GroupBy(ThisItem.activities; "cr1fd_quarter"; "actByQuarter")

 

- Inside the nested gallery template, I've added a label control and set the text to:

  "Quarter " & ThisItem."cr1fd_quarter"

 

- I've added another gallery within the nested gallery (refered as third gallery) and set the items to: 

  actByQuarter

 

- Within the third gallery template I've added the activity title as label with text set to: 

  ThisItem.Title

 

Unfortunately this whole thing is not working as expected. What I want to achieve is the following pattern: 

 

- Stream title (top gallery, streams)

      - Quarter 1 (nested gallery, ThisItem.activities grouped by quarter)

            - Activity title of an activity in q1 (third gallery, grouped activity title)

            - Activity title of an activity in q1 (third gallery, grouped activity title)

      - Quarter 2 (nested gallery, ThisItem.activities grouped by quarter)

            - Activity title of an activity in q2 (third gallery, grouped activity title)

- Stream title (top gallery, streams)

      - Quarter 1 (nested gallery, ThisItem.activities grouped by quarter)

            - Activity title of an activity in q1 (third gallery, grouped activity title)

 

Does anybody know what I'm doing wrong? 

Categories:
I have the same question (0)
  • R3dKap Profile Picture
    1,594 on at

    Hi @MHrast,

    For a starter, you can have only two levels of nested galleries inside Power Apps applications. So what you're trying to acheive (with a 3 level rendering of data) is not possible.

    So, if you managed to do so, I'm really curious to see how you did it. Can you post a capture?

  • MHrast Profile Picture
    26 on at

    I did not manage to do so because I've failed already with the GroupBy Statement. The quarter is not shown unfortunately. I've not yet tried to add a third gallery. Actually I try currently changing it from this state:

     

    - Stream title (top gallery, streams, sorted by activity quarter)

          - Activity title of an activity (nested gallery, activity title)

          - Activity title of an activity (nested gallery, activity title)

     

    to the state above. 

    Might there be a workaround to add quarter heading within the nested gallery if a third one is not possible? 

  • Verified answer
    R3dKap Profile Picture
    1,594 on at

    @MHrast,

    Ok, here's what I did on my side to try to reproduce your case.

    Just follow the steps below to do it on your side and then adapt it to your own case.

     

    1. Create a new screen

    2. Add a button and put the following code on its OnSelect property:

     

    ClearCollect(colStreams,{ID:1,Title:"Stream1"},{ID:2,Title:"Stream2"},{ID:3,Title:"Stream3"});ClearCollect(colActivities,{ID:1,StreamID:1,Title:"Activity1",Quarter:1},{ID:2,StreamID:1,Title:"Activity2",Quarter:1},{ID:2,StreamID:1,Title:"Activity3",Quarter:2},{ID:4,StreamID:1,Title:"Activity4",Quarter:2},{ID:5,StreamID:1,Title:"Activity5",Quarter:3},{ID:6,StreamID:1,Title:"Activity6",Quarter:4},{ID:7,StreamID:1,Title:"Activity7",Quarter:4},{ID:8,StreamID:2,Title:"Activity8",Quarter:1},{ID:9,StreamID:2,Title:"Activity9",Quarter:1})​

     

    3. Run the app and click on the button to generate the collections in memory

    4. Add a gallery GalleryStream on the screen

    5. In the Items property of GalleryStream, put the following code:

     

    GroupBy(colActivities, "StreamID", "StreamGroup")​

     

    6. Inside that gallery add a label and set its Text property to this: 

     

    LookUp(colStreams, ID = ThisItem.StreamID).Title​

     

    7. Next to that label add another gallery called GalleryActivities

    8. In the Items property of GalleryActivities, put the following code:

     

    ThisItem.StreamGroup​

     

    9. In that last gallery, add a label and set its Text property to this:

     

    "Q" & ThisItem.Quarter & " - " & ThisItem.Title​

     

    10. And that shows you how to nest the galleries...

     

    Tell me already if this example works on your side. You should see something like this (I used regular galeries in my test, not the flexible ones... but that's a detail):

    Image 4.png

    Now give me some time to think and figure out if there would be any way of simulating a third level by showing the "Qn" only when it changes for instance.

  • MHrast Profile Picture
    26 on at

    Not exactly what I was looking for, espacially due to the fact that the number of streams and associated activities vary (can be created / deleted), but I guess an acutal 3-level gallery will not be possible though I've only got 2 entities. 

     

    But It is helpful anyway. Will not be the best user experience at the end of the day but it's okay. So I guess I'll try that. Thank you 🙂 

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard