Skip to main content

Notifications

Power Apps - Building Power Apps
Suggested answer

How to not get Patch conflicts?

Like (1) ShareShare
ReportReport
Posted on 4 Oct 2024 19:02:45 by 153
Hello - I have a PA where whenever a user changes a data item, it patches the updated data to Sharepoint immediately. This works great until the user tries to work "too fast", and then we get a conflict error. As if, if I could just pause the PA enough between the user's mouse clicks, the error wouldn't happen. Is there a way to "pause" the power for 1 second after each Patch event, or something like that? THANKS!
Categories:
  • WarrenBelz Profile Picture
    WarrenBelz 144,316 on 19 Oct 2024 at 01:16:33
    How to not get Patch conflicts?
    Just following up to see if you received the answer you needed, or if you require further assistance.

    Please click 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 giving it a Like.
    MVP (Business Applications)     Visit my blog Practical Power Apps    Buy me a coffee
  • WarrenBelz Profile Picture
    WarrenBelz 144,316 on 05 Oct 2024 at 21:21:31
    How to not get Patch conflicts?
    To answer your question on a Timer (I am not saying this is the best/only solution as I could not duplicate your issue, no matter how fast I patched consecutive fields using the tab key to navigate). Put this at Screen OnVisible
    UpdateContext({varDelay: false})
    then this straight after your Patch
    UpdateContext({varDelay: true})
    then a timer with the settings Start
    varDelay
    OnTimerEnd
    UpdateContext({varDelay: false})
    Duration (you can adjust this to suit)
    1000
    The issue with this however if you are using the Tab key is that it does not go to your next field (you will find the same issue with the alternative from FLMike), so may not be what you need.
     
    Please click 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 giving it a Like.
    MVP (Business Applications)     Visit my blog Practical Power Apps    Buy me a coffee
  • Suggested answer
    FLMike Profile Picture
    FLMike 29,371 on 05 Oct 2024 at 17:35:57
    How to not get Patch conflicts?
    Hi,
     
    Can you please post your code, with a little more detailed.
     
    When you say too fast, do you mean they click the button more than 1 time?
    If so technically the Auto-disable property should block that if its turned on.
     
    Either way, another option would be to place a Context Variable when the form loads and set it true, for instance
    UpdateContext({ canClick: true} );
     
    Then in the controls OnChange
    in the first line of code
    UpdateContext( { canClick: false});
     
    then the last line of the controls OnChange
    UpdateContext({canClick: true } );
     
    Then put canClick in the controls DisplayMode so it will disable itself until the onchange is done
     
    If(canClick, DisplayMode.edit, DisplayMode.Disabled);
     
    As Warren said, I have never seen this, and I am not sure what a patch conflict even means.
     
    also, becareful if you are using Concurrent
     
     
     
  • timl Profile Picture
    timl 32,211 on 05 Oct 2024 at 13:32:08
    How to not get Patch conflicts?
    Hi CedarTree72
     
    You could maybe experiment with the spinner component from the Creator Kit.

    This could help block the user from triggering another Patch whilst a Patch is in progress.
     
     
     
  • CedarTree72 Profile Picture
    CedarTree72 153 on 05 Oct 2024 at 12:39:18
    How to not get Patch conflicts?
    Thanks! That's right. There's a patch that I run when "On Change" is triggered. Any specific examples of code you can point to? You would think (?) that PA would finish a patch before allowing the user to continue "entering data". Perhaps what I can do for every field is exit the OnChange code while the Wait variable is still active?
     
    Thanks!
  • WarrenBelz Profile Picture
    WarrenBelz 144,316 on 04 Oct 2024 at 21:34:07
    How to not get Patch conflicts?
    I assume here that you have an editable gallery with a Patch OnChange of each control in the record ? There would be a a way of starting a timer before the patch code for a second or so setting a Variable to true and then to false OnTimeEnd and making all the other fields View only while the Variable was true. To be honest I have never seen this issue posted, so I may not be correct in my assumption on your process.
     
    Please click 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 giving it a Like.
    MVP (Business Applications)     Visit my blog Practical Power Apps    Buy me a coffee

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

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #9 Get Recognized…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 144,316

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 64,290

Leaderboard
Loading complete