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 / "remember" selected ga...
Power Apps
Answered

"remember" selected gallery item

(0) ShareShare
ReportReport
Posted on by 384

Hi all,

I have an app that shows M365 groups in one gallery (colour coded depending if you are owner or member) and when clicking on a group in a second gallery the group member are shown.

When I add or remove members I might happen that the colour coding in the first gallery might change, so I "refresh" this gallery.

Unfortunaltely the last selected item is not remembered.

 

I tried the following:

1) when selecting an item in the first gallery
OnSelect: Set(recent_group, ThisItem) 

2) Default property of the gallery:

Default: recent_group

3) after refreshing the gallery:

Select(Gallery2_1,1, NextArrow3_1) (the "1" in the middle should be the selected item)

 

This does not work. Does anone has an idea what I can do to make this work?

Categories:
I have the same question (0)
  • LaurensM Profile Picture
    12,516 Moderator on at

    Hi @Frankie70 the code with a variable should work, but step 3 is not needed.

     

    (1) Gallery 1: OnSelect of the gallery should save the record to a variable

    Set(recent_group, ThisItem)

     

    (2) Gallery 1: The default property should be:

    recent_group

    (This record will automatically be selected after the resfresh/reset of the gallery)

     

    (3) Gallery 2: this gallery should be dependent on Gallery 1 via Gallery1.Selected. 

    Due to the Default Property of Gal1, no Select() function is needed to 'select' the previous item.

     

    An easy way to troubleshoot this issue is by changing the TemplateFill of Gallery 1 for the selected record:

    If(ThisItem.ID = Gallery1.Selected.ID, Blue, White)

    This will make debugging the issue easier.

     

    If this solves your question, would you be so kind as to accept it as a solution.

    Thanks!

     

  • Frankie70 Profile Picture
    384 on at

    @LaurensM thanks for you answer.

    Step 3 is done to select the last selected item to show the users in the 2nd gallery after the re-collect.

    But unfortunately the first steps do not work.

    I changed the TemplateFill to trouble shoot. But after re-collecting the items for the 1st gallery non of the items is highlighted. Any other idea?

  • LaurensM Profile Picture
    12,516 Moderator on at

    @Frankie70 with the Default property, step 3 will be done automatically. The Default record will be selected.

     

    To troubleshoot the issue further, would it be possible to do 2 things:

    1. Make sure the variable still has a value after the recollect of Gal1, normally this should be ok
    2. Change the Default property of Gal1 to the following:
    LookUp(CollectionName, ID = recent_group.ID)

    Change ID to a field that is unique for each record of Gal1.

     

    I hope this helps!

  • Frankie70 Profile Picture
    384 on at

    @LaurensM here must be the error somewhere.

    It gives me the following error message:

    Frankie70_0-1671632120241.png

     

  • LaurensM Profile Picture
    12,516 Moderator on at

    Hi @Frankie70 when you hover over the red line, what is the error that pops up?

     

    Is col_merged the Items property of that Gallery & the source of the recent_group record?

  • Frankie70 Profile Picture
    384 on at

    Hi @LaurensM 

    error message: "Invalid formula. Expected a value compatible with 'items'

    Items property of Gallery: GroupBy(col_merged, "Title", "Hubdata", "GroupId","_records")

    I use this because there are duplicated items in the gallery.

  • Verified answer
    LaurensM Profile Picture
    12,516 Moderator on at

    Hi @Frankie70 thanks for the additional info.

    In that case please adjust the Default to the following:

     

    LookUp(GroupBy(col_merged, "Title", "Hubdata", "GroupId","_records"), GroupId = recent_group.GroupId)
  • Frankie70 Profile Picture
    384 on at

    @LaurensM fantastic!

    This working now! Thank you so much!!

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 846

#2
Valantis Profile Picture

Valantis 532

#3
Haque Profile Picture

Haque 410

Last 30 days Overall leaderboard