cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
johnmarlowe
Level: Powered On

Update a Collection on select of a Gallery Item

Hi  - I'm possibly missing something obvious in how to acheive this, but in my app there is a primary search page and a gallery of client records. Whenever a client is selected in this table, it's primary information is displayed, as well as another gallery of previous contact records from a different table down the opposite side of the screen. The records for this preview are generated by filtering the client ID of the contact table as equal to the client ID of the the search gallery (i.e. Filter(contactRecordsTable, ClientID = gallerySearch.Selected.ClientID) My issue is that I'd like to store the contacts in a collection (lets call it contactRecordsCollection) so that each time I select a different record it uses the clear collect function

i.e. ClearCollect(contactRecordsCollection, Filter(contactRecordsTable, ClientID = gallerySearch.Selected.clientID))

OR

ClearCollect(contactRecordsCollection, Filter(contactRecordsTable, ClientID = ThisItem.clientID))

I've tried putting this in the OnSelect of the gallery but this doesn't appear to do anything when I select a record.

 

Am I missing something?

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: Update a Collection on select of a Gallery Item

Hi johnmarlow,

 

Couple of questions:

  • How are people affecting the data in the second gallery from the first data?
  • What I mean is, how are they interacting with the first gallery?  Are they tapping an icon visible on each row, or something on the row?

Also, I assume you're getting the results you want from testing - i.e. adding a button with the ClearCollect() formula somewhere and just check that the Filter() works the way you expect it to.  First make sure your ClearCollect() is working, then figure out where you want to put it 🙂

 

Assuming your formula is working:

If there's no specific control or object users are interacting with on each row of the first gallery, my approach would be to create an invisible overlay on the first row gallery card and put the ClearCollect() formula on the OnSelect property of that overlay. 

The invisible overlay is just a square/rectangular icon with no border, no fill, and ordered to be in front of everything else. 

 

If it's the same size as the Gallery card then it ensures that anyone tapping on the card will interact with the invisible rectangle, and it forms part of the ThisItem construct for row selections within the Gallery, so you can use the relevant Filter for your ClearCollect().  This of course means that it's impossible for anyone to interact with anything behind it, so just be aware of that and size accordingly 🙂

 

 

 

Hope this helps.

 

RT

View solution in original post

2 REPLIES 2
Highlighted
Super User
Super User

Re: Update a Collection on select of a Gallery Item

Hi johnmarlow,

 

Couple of questions:

  • How are people affecting the data in the second gallery from the first data?
  • What I mean is, how are they interacting with the first gallery?  Are they tapping an icon visible on each row, or something on the row?

Also, I assume you're getting the results you want from testing - i.e. adding a button with the ClearCollect() formula somewhere and just check that the Filter() works the way you expect it to.  First make sure your ClearCollect() is working, then figure out where you want to put it 🙂

 

Assuming your formula is working:

If there's no specific control or object users are interacting with on each row of the first gallery, my approach would be to create an invisible overlay on the first row gallery card and put the ClearCollect() formula on the OnSelect property of that overlay. 

The invisible overlay is just a square/rectangular icon with no border, no fill, and ordered to be in front of everything else. 

 

If it's the same size as the Gallery card then it ensures that anyone tapping on the card will interact with the invisible rectangle, and it forms part of the ThisItem construct for row selections within the Gallery, so you can use the relevant Filter for your ClearCollect().  This of course means that it's impossible for anyone to interact with anything behind it, so just be aware of that and size accordingly 🙂

 

 

 

Hope this helps.

 

RT

View solution in original post

johnmarlowe
Level: Powered On

Re: Update a Collection on select of a Gallery Item

Hi - That makes sense thanks. I had done a test with a button so I knew the ClearCollect formula worked,. Fortunatley they aren't interacting with anything on the primary gallery itself (beyond selecting the record),  so think your advice should work. I'll give it a go this morning.

 

Thanks

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 158 members 5,749 guests
Please welcome our newest community members: