Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
507 views
in Technique[技术] by (71.8m points)

powerapps - Power Apps - Restrict duplicate bookings in a booking system developed with model driven app

We are doing a POC on Power Apps with a trial version and we have developed a room booking app in Model-Driven App under Power Apps. If the User has booked any room and another user tries to book a room for the same date, it should not allow. It is an essential validation for any booking system but unable to find a way to achieve the same in Power Apps

For example: - If a user booked a room in Delhi from 1st to 5th Jan. Other users should not be allowed to book this room for the above dates. Another user books the same room for 1st Jan to 4th Jan then it should not allow but we have not found any feature in the model-driven app to restrict the entry of this record.

Does anyone know how to proceed?

enter image description here

question from:https://stackoverflow.com/questions/65949734/power-apps-restrict-duplicate-bookings-in-a-booking-system-developed-with-mode

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

This is a high level answer given the lack of specifics in your question. When the user selects a time, you should add the following to your OnSelect event of the gallery or button (whatever you use to let the user select the room).

//Refresh the datasource
Refresh(YourDatasource);

// Filter the data source looking for other events in this room
UpdateContext({RoomEvents,Filter(YourDataSource, RoomID=selectedRoom,Date=SelectedDate)});

// check if there are any items in RoomEvents. If there are, then the room is no longer available
if(RowCount(RoomEvents)>0,Notify("This room is no longer available",NotificationType.Error))

Again, this high level, but should get you going in the right direction. You should do something similar when displaying the list of rooms in the first place, filtering out rooms that are not available.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...