cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

avoid double write on excel from different users

Hi All,

I need to avoid different user be able to write same data on excel file by clicking a button.

If 2 users click the button contemporary they can write the same data also if I check data existing on excel before.

Is there some function helpful to lock excel data source on click button ? 

Thanks in advance 

Elia 

2 ACCEPTED SOLUTIONS

Accepted Solutions

@Anonymous ,

You might consider converting to SharePoint

View solution in original post

@Anonymous ,

SharePoint has the ability you are seeking, as long as you use SubmitForm to write data. If the record has been changed from the one on the form, the second user will get an error message and their data will not write. The Excel interface does not do this (as you have discovered).

 

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.

View solution in original post

26 REPLIES 26
Super User III
Super User III

On your Submit button or Patch button put;

If(CountRows(Filter(DataSource,ColumnName = Textbox1.Text)) > 0,Notify(" Record Exist"), SubmitForm (FormName))

 

Please Change Textbox 1 Datasource and ColumnName to your actual name

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Anonymous
Not applicable

yes I do this check before to patch the excel but I noticed that 2 users are able to write same data if the button clicks are simultaneous.

It seems it take much to write on excel 

Following the code 

 

Refresh(BookingData);

if(CountRows(
Filter(//User has already booked for this date
BookingData,
BookingDate = Text(
selectedDate,
"[$-it-IT]dd/mm/yyyy"
),
Status = "Booked"
)
) > 0,
Set(
reason,
"userDateAlreayBooked"
);
Navigate(Unavailable),
Patch(
BookingData,
Defaults(BookingData),
{
BookingDate: Text(
selectedDate,
"[$-it-IT]dd/mm/yyyy"
),
Seat: Button1.Text,
BookingUser: User().FullName,
Status: "Booked",
Floor: "First",
Email: User().Email,
ActionDate: Text(
Today(),
"[$-it-IT]dd/mm/yyyy"
)
}
);
Navigate(Success)
)

Super User III
Super User III

Excel might be slow but Check the formatting of bookingDate in 

 

BookingDate = Text(
selectedDate,
"[$-it-IT]dd/mm/yyyy")

 

 

Also what is the purpose of:
Status = "Booked"

 

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Anonymous
Not applicable

Is not possible to lock the datasource ? 

 

You didn't respond to my post.

What is locking Datasource, you don't want users to Use the Datasource?

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Anonymous
Not applicable

What I mean is to lock datasource during read and write operation 

To avoid writing the same data, I suggest you make that field automatic so that users will have nothing to do with it. So Auto numbering of the field or using Guid() could help prevent same data by different users

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Anonymous
Not applicable

yes , if the record is already written on excel I disable the button ant it works , but if I have 2 users at the same time that connect to the app and click the Seat button to book a place , they can because could happen they click at the same time the button, so the refresh operation read excel at the same time and my checks fail.

If I could do the refresh, the filter and the patch operations atomically I could solve the issue because only one user per time can have the lock to the data source

Thanks again 

Then at the beginning of the Patch refresh the Datasource;

Refresh(Table1);Patch(......)

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (12,959)