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 / Updating a Collection ...
Power Apps
Unanswered

Updating a Collection from a Gallery

(0) ShareShare
ReportReport
Posted on by 145

I need help with this!  Here is how my app works right now.  I have 4 with the onchange for each combobox with the following code: 

ClearCollect(Data,Filter(DataSource,Lookup = Label1.Text))

 

The value of the comboboxes are combined into a label (label1) and that is the lookup to filter my datasource which creates my collection.  The collection is the used for my gallery.  

 

I use the following code to create row numbers for each items in my gallery.  

Patch(Data, Defaults(Data));
ForAll(
Data,
Collect(
tempCollection,
Last(
FirstN(
AddColumns(
DropColumns(
Data,
"RowNumber"
),
"RowNumber",
CountRows(tempCollection) + 1
),
CountRows(tempCollection) + 1
)
)
)
);
ClearCollect(
Data,
tempCollection
);
Clear(tempCollection)

This will create a new line and number everything 1 to whatever.  I use this row number to do my patch.  There is another combobox inside my gallery that uses the following code on change: Patch(Data, Lookup(Data, RowNumber = ThisItem.RowNumber), {Item: Combox2.Selected.No_}) 

 

Unfortunately, this patch looks like it works for a second then reverts back to what it was a second ago.  What am I doing wrong?

Categories:
  • dyee Profile Picture
    145 on at

    I've been breaking down the code.  I think the issue is the onchange in the gallery.  It looks like when the gallery changes it overrides everything.  However, I'm not having a new problem.  It's saying Patch(Data,Defaults(Data)); is invalid O.O

     

    I hate this app.

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
11manish Profile Picture

11manish 393 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 278 Most Valuable Professional

Last 30 days Overall leaderboard