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 Apps
Unanswered

Gallery Updates

(0) ShareShare
ReportReport
Posted on by 765 Super User 2024 Season 1

I have a gallery with 6 columns.  One is calculated based on the values in two other columns.

The gallery is tied to a Collection.

 

Total Cost = Unit Count * Unit Cost.

 

When the Unit Count or the Unit Cost are changed (OnChange() event) I do an UpdateIf() for the current item.

 

 

UpdateIf( collection, ItemID = ThisItem.ItemID, {TotalCost: ThisItem.UnitCount * ThisItem.UnitCost} )

 

 

This update works but the change is not reflected in the gallery.  I tried a Reset on the gallery, but that doesn't do anything.

 

The Default for the Total Cost item is ThisItem.'Unit Count' * ThisItem.'Unit Cost'.

 

What am I missing?

 

Thanks. 

Categories:
  • rebeccas Profile Picture
    2,591 on at

    How do you know the update works? Where do you see it changing? 

    If your Default for the total Cost is based on the calculation (in your gallery) and not just ThisItem.TotalCost then you will need to change your update to change the UnitCount and UnitCost instead of updating the TotalCost.

     

    What I do often is don't include the TotalCost as a column in my collection but just show the calculated value in the gallery...it causes less confusion I think. 

  • sperry1625 Profile Picture
    765 Super User 2024 Season 1 on at

    Those Edit Boxes are tied to ThisItem.<Column Name>.  Editing the text box should update the underlying collection, correct?  Or do I have to do that myself.  I tried adding an UpdateIf to the change event for the UnitCount text box

    UpdateIf( collection, ItemID = ThisItem.ItemID, {UnitCount: Value( Self.Text ) } )

    When I did that the Total Cost was updated. Do I have to update the collection directly for every change? 

  • rebeccas Profile Picture
    2,591 on at

    A collection is "stagnant data"...it is useful for loading times because of that. If you make a change to your data source you will need to update the collection also. I typically just add in a ClearCollect() behind my patch that updates my data source OR I have the the Patch on the data source and another Patch on the collection. 

     

    Either of those options will ensure your collection is being updated and your data source and make the gallery match the data.

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 221 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 188 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 120

Last 30 days Overall leaderboard