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 / OnChange Patch into co...
Power Apps
Unanswered

OnChange Patch into collection not firing when new Gallery item selected

(1) ShareShare
ReportReport
Posted on by

I have a gallery with survey topics, and a rich text input box outside the gallery.

The default property of the rich text input is a lookup into collection 'ResponseCollect'.

OnChange has a patch function in an attempt to get the user's input written into the collection when they click onto the next item in the gallery.

The text is written only if the user clicks elsewhere on the page before selecting the next gallery item. If a gallery item is selected the text input is lost.
How can i ensure the OnChange function is triggered when a new gallery option is selected? OnSelect of the Gallery is currently blank

 

 

Default:
LookUp(ResponseCollect, Topic = Gallery.Selected.TopicInput.Text, Commentary)
//ResponseCollect is the collection of all responses, this is later patched to SQL
//Gallery holds the topics of the survey for which the user needs to provide commentary

OnChange:
Set(NewResponse, Defaults(ResponseCollect));
//NewResponse collection is used to patch a single row to ResponseCollect

Set(NewResponse,
 Patch(NewResponse,
 {Topic: Gallery.Selected.TopicInput.Text,
 Commentary: Narrative.HtmlText,
 Customer: Customer.Text, 
 ProjectName: ProjN.Selected.Value, 
 ProjectID: ThisProjectID.Text, 
 SurveyConductedBy: Conducted_By.Text, 
 SurveyDate: Survey_Date.SelectedDate, 
 PersonSurveyed: Person_Surveyed.Text}));

Patch(ResponseCollect,
 Coalesce(LookUp(ResponseCollect, Topic = Gallery.Selected.TopicInput.Text)),
 Defaults(ResponseCollect),
 NewResponse)

 

 


 

Categories:
I have the same question (0)
  • developingteal Profile Picture
    392 on at

    instead of using onChange, build something that concurrently checks if the row has changed - though this should be done in onChange, this is a fool proof way of doing it. 

     

    The expression would be like : if(id changes,  then run current on change)

     

    I would put the expression in something like a timer or whatever way you want it to constantly check.

  • developingteal Profile Picture
    392 on at
    What's the status of this/ what's the current error?

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 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard