Atomic operation

Assuming I would like to develop a simple booking app. list of rooms and users that can book a room.
Although I know how to develop it, I have a general question about multi user and appsheet architecture.
Is there a way to ensure that two users will NOT book the same room, just because they did the booking at the same moment when the room was free? Because Appsheet does the change locally and syncs later, how can this update conflict be identified and prevented?

0 3 510
3 REPLIES 3

Reza2
New Member

I do not think with current architecture which allows for offline data updates you could prevent double booking, unless the booking happens only by one user, or by one device.

You could allow double-booked requests though, just donโ€™t allow the user to proceed with the booking. Try creating a slice that contains only the room number and date, then create a form that allows users to submit a request to book a room.

Then setup a workflow to approve the request for booking IF no other requests for that room exist for the day. That way the check is done on the server, and only unlocks the request for booking on the first request for the day. A [Status] column could track the progress (โ€œRequestedโ€, โ€œBookingโ€, โ€œBookedโ€) and be used as your filter condition for the workflow and slice.

Thanks. Just to add, even when the check is done on the server you need a specific atomic operation to prevent two from booking on the same moment. I think the way to get this atomic operation is by checking the [_THISROW_BEFORE].[requesting user] and [_THISROW_AFTER].[requesting user]
Only once the โ€˜beforeโ€™ will be empty and the โ€˜afterโ€™ is not empty. This is the user that โ€œwonโ€ the room.

Top Labels in this Space