cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
m0le
Helper II
Helper II

How to protect from overwriting the same record by users

Hi Team 

 

I have desk booking app and as more users coming back to office(App usage goes up) I have encounter a new issue where users booked the same desk in the same time. 

Here is the final code where App patch the data in to excel I have tried make a logical test which would check right before patch if maybe the record is already used but that didn`t worked.  

 

//** Logical Test if somone booked the desk already in the same time
If(
    IsBlank(LookUp(Table3,DeskNumber = lblDeskNumberResult.Text , UserID)), 
//** Negative test result: I am updating the HotDesks Spreadsheet **//
    ForAll   
            (GalFinal.AllItems, Patch(Table3,LookUp([@Table3], lblDeskNumberResult.Text=DeskNumber ),
            {UserName: lblNameResult.Text,
            UserID: UserIDVariable,
            Date: lblBookingDateResult.Text}));

Notify("Desk booked successfully, we look forward to seeing you in the office...",NotificationType.Success) && Navigate(BoomScr, Fade), //**Aviable
//** Positive test result: stop user and request to pick another desk     
    Notify("Looks like someone has booked that desk already in the same time, could you please go back and select another desk",NotificationType.Warning); //**Busy
)

 

 Is there any other way to protect my excel from updating the same record by two users in the same time? 

1 REPLY 1
RandyHayes
Super User
Super User

@m0le 

You might want to consider doing a Refresh on the DataSource at the beginning of this formula.  That way, if someone has updated it, you will then refresh and get the update.

 

If you have a scenario where two users are doing this at the exact same time and that is an issue, then you will need to consider a broker to the data (ex. PowerAutomate).

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (1,395)