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 / Editable Gallery Buy Q...
Power Apps
Suggested Answer

Editable Gallery Buy Qty Updates Wrong Row During Rapid Number Input

(0) ShareShare
ReportReport
Posted on by

Hi Everyone,

I'm facing a rare issue in a Canvas Power App and would appreciate any guidance or suggestions.

Scenario

I have an Inventory Management application developed using Power Apps Canvas App. The main screen displays around 5,500+ inventory items in an editable gallery/grid. Each row contains a Buy Qty number input control (with up/down spinner arrows) that allows users to update the quantity before creating a Purchase Order (PO) or Transfer Order (TO).

Issue

Occasionally, when a user updates the Buy Qty very quickly using the up/down spinner arrows and immediately starts editing the next row, the previously edited row's Buy Qty changes unexpectedly.

For example:


  1. Update Item A Buy Qty from 0 → 5 using the spinner.

  2. Immediately move to Item B and start increasing its Buy Qty.

  3. Rarely, Item A's Buy Qty automatically changes again (for example from 5 → 6 or another unexpected value) even though the user is currently editing Item B.

  4.  

The user never intentionally modifies Item A again.

Frequency


  • This issue is very rare.
     
  • It cannot be reproduced consistently.

  • It has only been observed on one colleague's system.

  • Other users have not experienced this issue so far.
     

Environment


  • Power Apps Canvas App

  • Editable Gallery

  • Number Input control (Buy Qty)

  • Around 5,500 inventory records

  • Users frequently update multiple rows before creating PO/TO

  •  

What I Want to Understand

I'm trying to determine the root cause of this behavior.

Some questions I have are:


  1. Can this happen because the user's PC is slow?

  2. Can a slow browser or network delay cause Power Apps to update the wrong row?

  3. Is this related to Gallery virtualization or control reuse?

  4. Could asynchronous Patch(), UpdateIf(), or collection updates cause this behavior?

  5. Has anyone experienced a similar issue when editing Number Input controls rapidly inside an editable gallery?
     

Additional Information


  • The issue mainly occurs when the user edits values very quickly.

  • It is difficult to reproduce.

  • There are no visible Power Apps errors.

  • No formula errors are shown.

  • The app works correctly most of the time.
Following is code of Buy Qty control OnChange property:
 
Set(
    _baseQty,
    If(
        ThisItem.minimumOrderQuantity = "PALLET",
        Value(ThisItem.palletQuantity),
        Value(ThisItem.boxQuantity)
    )
);
Set(
    _inputQty,
    IfError(
        Value(numInpBuyQty.Value),
        Blank()
    )
);
If(
    _inputQty <= 0,
    RemoveIf(
        rowData,
        Text(locationId)
        & "|" & Text(itemICSCode)
        & "|" & Text(itemId)
        =
        Text(ThisItem.locationId)
        & "|" & Text(ThisItem.itemICSCode)
        & "|" & Text(ThisItem.itemId)
    );,
    _inputQty = 0
);
Set(
    _finalQty,
    If(
        IsBlank(_inputQty),
        _baseQty,
        If(
            _inputQty = 0,
            0,
            If(
                _inputQty < _baseQty,
                _baseQty,
                If(
                    Mod(_inputQty, _baseQty) <> 0,
                    RoundUp(_inputQty / _baseQty, 0) * _baseQty,
                    _inputQty
                )
            )
        )
    )
);
UpdateIf(
    colAllReplenishment,
    locationId = ThisItem.locationId &&
    itemICSCode = ThisItem.itemICSCode &&
    itemId = ThisItem.itemId,
    {
        buyQuantity: _finalQty
    }
);
UpdateIf(
    filtered_Replenishment,
    locationId = ThisItem.locationId &&
    itemICSCode = ThisItem.itemICSCode &&
    itemId = ThisItem.itemId,
    {
        buyQuantity: _finalQty
    }
);
UpdateIf(
    rowData,
    locationId = ThisItem.locationId &&
    itemICSCode = ThisItem.itemICSCode &&
    itemId = ThisItem.itemId,
    {
        buyQuantity: _finalQty
    }
);
Set(
    base_Replenishment,
    ForAll(
        base_Replenishment,
        If(
            locationId = ThisItem.locationId &&
            itemICSCode = ThisItem.itemICSCode &&
            itemId = ThisItem.itemId,
            Patch(
                ThisRecord,
                { buyQuantity: _finalQty }
            ),
            ThisRecord
        )
    )
);
Reset(numInpBuyQty);
SetFocus(setFocusSearchInv);

If anyone has experienced something similar or has suggestions on what to investigate, I'd really appreciate your help.

Thank you!

BuyQtyIssue.mp4

Your file is currently under scan for potential threats. Please wait while we review it for any viruses or malicious content.

I have the same question (0)
  • MS.Ragavendar Profile Picture
    7,431 Super User 2026 Season 1 on at
     
    Point 1 :
     
    Being a Power Apps developer only way to isolate the issue can be achieved by the Monitor and Performance insights for Power Apps canvas app which will help us to identify the information for performance and helps to perform the debugging.
     
    Just a query , Have you ever run Monitor on the colleague’s system and capture the information.
     
    Kindly refer this to know about the Live monitor overview.
     
    Point 2 :
     
    Since you are using the Editable Gallery have you used the Unique Row ID to the Data-Source which you are binding, Row Id will helps us to update only the rows which are altered. 
     
     
    ✅If this helped, please Accept as Solution to help others ❤️ A Like is appreciated 🏷️ Tag @MS.Ragavendar for follow-ups.
  • Suggested answer
    WarrenBelz Profile Picture
    155,838 Most Valuable Professional on at
    I will give you a couple of suggestions - not sure how helpful they are as these types of errors are hard to validate thta you have actually fixed them. Firstly your issue may be the variables you are setting at the start being over-written by the next code run before the first one is finished - you can use a With() variable which exists in the context of the code run - example
    With(
       {
          _Record1:
          LookUp(
             colAllReplenishment,
             locationId = ThisItem.locationId &&
             itemICSCode = ThisItem.itemICSCode &&
             itemId = ThisItem.itemId
          ),
          _Record2:
          LookUp(
             filtered_Replenishment,
             locationId = ThisItem.locationId &&
             itemICSCode = ThisItem.itemICSCode &&
             itemId = ThisItem.itemId
          ),
          _Record3:
          LookUp(
             rowData,
             locationId = ThisItem.locationId &&
             itemICSCode = ThisItem.itemICSCode &&
             itemId = ThisItem.itemId
          ),
          _baseQty,
          If(
             ThisItem.minimumOrderQuantity = "PALLET",
             Value(ThisItem.palletQuantity),
             Value(ThisItem.boxQuantity)
          ),
          _inputQty,
          IfError(
             Value(numInpBuyQty.Value),
             Blank()
          )
       },
       With(
          {
             _finalQty,
             If(
                IsBlank(_inputQty),
                _baseQty,
                _inputQty = 0,
                0,
                _inputQty < _baseQty,
                _baseQty,
                Mod(_inputQty, _baseQty) <> 0,
                RoundUp(_inputQty / _baseQty, 0) * _baseQty,
                _inputQty
             )
          },
          If(
             _inputQty <= 0,
             RemoveIf(
                rowData,
                Text(locationId) & "|" & Text(itemICSCode) & "|" & Text(itemId) =
                Text(ThisItem.locationId) & "|" & Text(ThisItem.itemICSCode) & "|" & Text(ThisItem.itemId)
             ),
             _inputQty = 0
             Patch(
                colAllReplenishment,
                _Record1,
                {buyQuantity: _finalQty}
             );
             Patch(
                filtered_Replenishment,
                _Record2,
                {buyQuantity: _finalQty}
             );
             Patch(
                rowData,
                _Record3,
                {buyQuantity: _finalQty}
             )
          )
       )
    );
    Set(
       base_Replenishment,
       ForAll(
          base_Replenishment,
          If(
             locationId = ThisItem.locationId &&
             itemICSCode = ThisItem.itemICSCode &&
             itemId = ThisItem.itemId,
             Patch(
                ThisRecord,
                { buyQuantity: _finalQty }
             ),
             ThisRecord
          )
       )
    );
    Reset(numInpBuyQty);
    SetFocus(setFocusSearchInv);
    The other more "nuclear" option - which may not suit your user's requirement is to stop further execution untill the current code is run - put a Variable at the start of the code
    UpdateContext({varEditGal: false})
    and at the end of the code
    UpdateContext({varEditGal: true})
    also use the second one at Screen OnVisible or anywhere else you need to enable the gallery. Then put the DisplayMode of the Gallery
    If(
       varEditGal,
       DisplayMode.Edit,
       DisplayMode.Disabled
    )
    this will stop a subsequent update until the first one is finished. I have used this to stop users double-clicking on buttons and running things twice.
     
    Also @MS.Ragavendar's point on the unique record ID is very relevant - you did not say what your data source was, but if SharePoint (particularly) or Dataverse, there is a much better way of referring to the target record rather than the lookup you are using.
     
    Please Does this answer your question 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 answering Yes to Was this reply helpful? or give it a Like
    Visit my blog
    Practical Power Apps    LinkedIn  
  • WarrenBelz Profile Picture
    155,838 Most Valuable Professional on at
    A quick follow-up to see if you received the answer you were looking for. Happy to assist further if not.
     
    Please Does this answer your question 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 answering Yes to Was this reply helpful? or give it a Like ♥
    Visit my blog
    Practical Power Apps    LinkedIn   

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 424

#2
WarrenBelz Profile Picture

WarrenBelz 355 Most Valuable Professional

#3
11manish Profile Picture

11manish 290

Last 30 days Overall leaderboard