Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building 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)

 

 


 

  • developingteal Profile Picture
    392 on at
    OnChange Patch into collection not firing when new Gallery item selected
    What's the status of this/ what's the current error?
  • developingteal Profile Picture
    392 on at
    Re: OnChange Patch into collection not firing when new Gallery item selected

    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.

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,524 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,906 Most Valuable Professional

Leaderboard