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 / Editable Gallery trigg...
Power Apps
Unanswered

Editable Gallery triggering OnChange upon Patch

(0) ShareShare
ReportReport
Posted on by 10

Hi all,

 

I have a gallery that has comboboxes and datepickers which will update to a collection if OnChange is triggered. This will then patch to the Sharepoint list once a save button is clicked. 

 

I am having an issue where once the button is clicked, while the Patch runs successfully, all my gallery items are re-collected back into the collection as if a change was made. The comboboxes DefaultSelectedItems=ThisItem.ColumnaName and likewise for the DefaultDate. 

 

If I run OnStart to clear the collection, the collection is empty and no OnChange is triggered. However, once I go back to press the save button, OnChange is triggered for ALL records and my collection is full and will not clear again, triggering a loop where all item are constantly added into the collection. 

 

Save button OnSelect is: If(CountRows(colUpdates)>0,Patch('QC Scheduling (AMATS)',colUpdates));Notify("Success", NotificationType.Success);Clear(colUpdates);

 

Please advise on what is going on as it seems like something is triggering PowerApps to detect that a change is being made.

Categories:
  • Spamrancher Profile Picture
    345 on at

    I believe that Clear(colUpdates) will cause an OnChange to fire. What is the Items of the Gallery? My guess is your Patch then refreshes the Items in the Gallery, which causes the OnChange to fire. You might add a variable (IsPatching) that is true when you Patch and Refresh, then false at the end of that. Then change your OnChange to only Collect if IsPatching is false.

  • tanshaun95 Profile Picture
    10 on at

    Yes, the only Collect is in OnStart. I am basically using this check to indicate to users that there are records where a change has been made, but the save button has not been clicked. 

     

    After patching, I can confirm that the collection clears, then shortly after, the collection fills up again. I have an icon that is only visible if the same item ID is in the collection, and that icon disappears after patching and re-appears in a few seconds.

     

    I did further research and seems like the ComboBox resets itself after patch, and PowerApps somehow recognizes that as an OnChange. I will have to implement a different solution to this.

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 236 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 188 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 130

Last 30 days Overall leaderboard