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 / dropdown onchange coll...
Power Apps
Answered

dropdown onchange collects all rows in collection

(0) ShareShare
ReportReport
Posted on by 47

I have created a Blank Vertical Gallery that displays data from the SharePoint list. There are several dropdown fields and some text fields. 

I have added a button field with the following code in its OnSelect and called Select(button) on all the above field's OnChange property.

 

If(
IsBlank(
LookUp(colGridUpdates1,
ID = ThisItem.ID
)
),
Collect(colGridUpdates1,
ThisItem
)
);

UpdateIf(
colGridUpdates1,
ID = ThisItem.ID,
{
Location:drpdLocation1.Selected,
Reference_ID:Value(txtReference_ID.Text),
Approved:drpdApproved1.SelectedText
}
)

 

 I then path the collection to the SharePoint using the following code. I clear the collection at the end of "Save" but the collection reloads all the items again as if the OnChange action was called on all items.

 

Patch(
 'GFS FSS',
 ShowColumns(
 colGridUpdates1,
 "Location",
 "Reference_ID",
 "Approved",
 "ID"
 )
);
Notify("Grid changes updated successfully",
 NotificationType.Success,
 1500
);
Clear(colGridUpdates1);

 

 

Categories:
I have the same question (0)
  • PritishT Profile Picture
    47 on at

    @WarrenBelz  [ Sorry to tag you guys directly but wanted to bring your attention ASAP]

  • BCLS776 Profile Picture
    8,994 Moderator on at

    Hi Pritish,

     

    Consider not using OnChange as the trigger for these kinds of update operations. The combination of the gallery and the Patch() can lead to unexpected trigger events and data integrity problems. As well, depending on the style of controls you are using (modern vs classic), OnChange can behave very differently.

     

    Consider using OnChange for raising flags when data has changed or user input is incorrect, but a separate control with OnSelect for the actual data update.

     

    Hope that helps,

    Bryan

  • Verified answer
    WarrenBelz Profile Picture
    155,463 Most Valuable Professional on at

    @PritishT ,

    Firstly @BCLS776 is correct here - OnChange triggers on a Combo Box as soon as it is presented. The only effective way of stopping it is to compare its current value with its DefaultSelectedItems - simple example

    If(
     Self.Selected.Value <> ThisItem.DisplayedField.Value,
     DoYourOnchangeCode
    )

     

  • PritishT Profile Picture
    47 on at

    @WarrenBelz , this worked perfectly, many thanks.

    @BCLS776 Thanks for the explanation.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 610

#2
Haque Profile Picture

Haque 317

#3
WarrenBelz Profile Picture

WarrenBelz 315 Most Valuable Professional

Last 30 days Overall leaderboard