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 / Collect items in galle...
Power Apps
Unanswered

Collect items in gallery where changes have me made filter resets collections

(0) ShareShare
ReportReport
Posted on by 17

Hi All,

I have designed a screen using a gallery with the datasource of a collection that contains information about that user. Users of the app can go in and update the information if needed; it contains dropdowns and text inputs.

 

If a tag, project tag, or comment is changed compared to the original data, then I want that item added to a separate collection. However, if that item is then changed back to its original submission in the collection, then that item can be removed.

 

The problem I am having is that because my gallery has dropdown filters to find the right people in the gallery (i.e., department, grade, etc.), the moment I remove items in the filter or search, it seems to reset my gallery, which, in return, deletes items in my collection and only keeps the last one I have updated.

 

To manage changes, I have been trying this out, which seems to work fine as long as I don't use filters:

On one of the text input boxes of the gallery, I have this in the OnChange Property: 

 

If(
 ThisItem.Tag.Value <> ComboBox1_3.Selected.Value,
 If(
 IsEmpty(Filter(ColBencherReview2, ID = ThisItem.ID)),
 // If no matching record is found in ColBencherReview2, add a new record
 Collect(
 ColBencherReview2,
 {Tag: ComboBox1_3.Selected,
 'Project Tag': TextInput1_7.Text,
 Comments:TextInput1_6.Text,
 ID: ThisItem.ID,
 Changed: true,
 Name: ThisItem.'Name (field_4)'
 }
 ),
 Patch(
 ColBencherReview2,
 LookUp(ColBencherReview2, ID = ThisItem.ID),
 {
 Tag: ComboBox1_3.Selected
 }
 )
 ),
 // If no update is needed, set Changed to false in ColBencherReview
 Remove(ColBencherReview2, LookUp(ColBencherReview2, ID = ThisItem.ID))
)

 

Categories:
I have the same question (0)
  • Michael E. Gernaey Profile Picture
    53,968 Super User 2026 Season 2 on at

    Hello,

     

    I am going to make an assumption that changes to the back end do not actually happen until they do some action directly, meaning changes in the UI do not reflect in the back end right away.

     

    If this is the case, then you should have the StartingState collection, which can drive the UI also, never change. Simply treat the values in the UI as the Current State.

     

    Whenever they go to do the action that would save, or when you need to compare, only then do you compare the values in the UI to the StartingState collection. The StartingState collection then ONLY changes when they do whatever it is that would make it save to the back end. In which case you can literally swap the CurrentState values into the "StartingState" collection and its now updated.

     

    I do not normally recommend patching a StartingState collection until you actual go to save the data. If for any reason you need to do more then I have explained, then I suggest you have a StartingState and CurrentState collections that match initially and CurrentState is updated based on changes, but you only validate the comparison later on, not as the people change.

     

    That way you dont ever lose the Original/Starting state and you do not lose the ability to compare across screens etc as its all in collections.

     

    Please let me know if this helps and mark Kudos or Answer or feel free to ask questions back.

  • ArturDjali10 Profile Picture
    17 on at

    Hi @FLMike ,

     

    Thank you for taking the time to respond.

     

    I do have two collection, one which is the original and the other contains the changes i have made. The main problem is that when i am using my filters to refine results in the gallery then i am losing the data i have saved in my second collection tracking the changes.

     

    Its as if the gallery is resenting back to the start when i clear my filters to find another user.. if that makes sense.

     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 358 Most Valuable Professional

#2
11manish Profile Picture

11manish 214 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 185

Last 30 days Overall leaderboard