web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Gallery - Patch On Change
Power Apps
Answered

Gallery - Patch On Change

(0) ShareShare
ReportReport
Posted on by 39

We have a gallery in a power app where we are trying to patch onchange. When typing into the field it blanks out and then the 2nd try it sticks. Is there a better way to do this? Here is the generic expession we are using: 

Patch('NPNF.PART_BOM', ThisItem, {QNTY_NUM:Value(Self.Text)})
Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,773 Most Valuable Professional on at

    Hi @alecnelson01 ,

    Have you checked the data source after the first attempt to see if it actually patched and your issue is that the gallery is not refreshing with the patched value ? If this is the case, what is the Items of the Gallery ?

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • AN-27081302-0 Profile Picture
    39 on at

    This is the expression for the Items: 

    Filter('NPNF.PART_BOM',PART_NUM=inpBOM_PART_NUM.Text)
    I did see on another thread that a Save button may be better than using OnChange
  • MarkRahn Profile Picture
    1,332 Super User 2026 Season 1 on at

    Hi @alecnelson01 ,

     

    Does your Collection have a Unique Identifier or ID?

     

    I was doing something similar with a Gallery recently and I was having trouble using the Patch() function. I ended up using an UpdateIf() instead. Something like:

     

    UpdateIf('NPNF.PART_BOM', ID=ThisItem.ID, {ID:ThisItem.ID,QNTY_NUM:Value(Self.Text)})

     

     

    When I was adding Items to the Collection (from the click on an Add icon), I used something like:

     

    Collect(
     'NPNF.PART_BOM',
     {
     ID: If(
     CountRows('NPNF.PART_BOM') > 0,
     Last('NPNF.PART_BOM').ID + 1,
     1
     ),
     QNTY_NUM: 0
     }
    );

     

    This is all assuming you are working with a Collection.

     

    If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. I am trying to become a Super User like @WarrenBelz 

    Thanks.

    -Mark

     

  • AARON_C Profile Picture
    2,235 Most Valuable Professional on at

    Hi @alecnelson01 

     

    I have used this exact formula in one of my apps. I have a save button and it works perfectly fine. 

     

    The OnChange save to a collection, then the save button patches the collection to your data source. 

  • WarrenBelz Profile Picture
    153,773 Most Valuable Professional on at

    Hi @alecnelson01 ,

    I am assuming that 'NPNF.PART_BOM' is your data source - what type is this ? Also have you checked on it if the first patch is working.

  • AN-27081302-0 Profile Picture
    39 on at

    NPNF.PART_BOM is a SQL table. The first time I try to enter a value into a column it blanks out and does not patch. If I enter a value and then click somewhere else outside of the gallery and go to the next column I have no issues.

  • AN-27081302-0 Profile Picture
    39 on at

    @MarkBandR The collection is called colPart_BOM

  • WarrenBelz Profile Picture
    153,773 Most Valuable Professional on at

    @alecnelson01 ,

    Can you please tag whoever you want to assist you here - multi-directional conversations just confuse everyone 

  • AN-27081302-0 Profile Picture
    39 on at

    @WarrenBelz I agree. I will work with you. What should my next steps be?

  • WarrenBelz Profile Picture
    153,773 Most Valuable Professional on at

    Hi @alecnelson01 ,

    Just to confirm all the "bits" here. You have a (I assume Classic) Text Input with the OnChange property of

    Patch(
     'NPNF.PART_BOM', 
     ThisItem, 
     {QNTY_NUM: Value(Self.Text)}
    )

    The Items of your Gallery are

    Filter(
     'NPNF.PART_BOM',
     PART_NUM = inpBOM_PART_NUM.Text
    )

    so my first issue here is confirming that inpBOM_PART_NUM is a different Text input to the one mentioned above (I assume it is as that one is the quantity).

    The second question is confirming my earlier query - have you checked the data source to see if the initial OnChange actually wrote the data and the issue is the Gallery not refreshing (which it should given you are connected directly to the data source).

     

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!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 105 Most Valuable Professional

#2
Haque Profile Picture

Haque 77

#3
VASANTH KUMAR BALMADI Profile Picture

VASANTH KUMAR BALMADI 70

Last 30 days Overall leaderboard