web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Preventing duplicate e...
Power Apps
Unanswered

Preventing duplicate entries in a SharePoint list within a Date Range

(0) ShareShare
ReportReport
Posted on by 2

Hello

 

I have a Calendar in Power Apps with a Sharepoint list as data source. People can reserve Rooms full days or for multiple days. In the Sharepoint List there is an entry for Check-in date and Check-out date.

 

If a user fills out the booking form, i want to prevent double booking of a room.

 

For example:

If Room 2 is currently booked from 2nd April to 5th April it should not be possible to book it from 4th to 8th April.

 

I can imagine it can work somehow like that in "dummy code":

 

 

If(Room is already booked between Check-in and Check-out;

Notify("Room is already Booked on selected date";
 NotificationType.Error);;
 Reset(Self)

 

 

 

Any ideas on how to solve this? Thanks

 

Regards

Dario

 

 

 

 

Bildschirmfoto 2022-03-29 um 13.32.14.png
Bildschirmfoto 2022-03-29 um 13.33.26.png
Categories:
  • EdViegas Profile Picture
    436 on at

    If in your list you have a date column for checkin and checkout, you can use Filter (delegable for date columns) in conjunction of CountRows as:

     

    If(
     CountRows(
     Filter(
     MyBookingList,
     And(
     checkin >= DataPickerIn.SelectedDate,
     checkout <= DataPickerOut.SelectedDate,
     room = TextInputRoom.Text
     )
     )
     ) = 0,
     Notify("Room is already Booked on selected date", NotificationType.Error),
     Reset(Self)
    )

     

  • dariotschannen Profile Picture
    2 on at

    Thank you. I tried it, but i think it fails on the "Room". My Room is a drop down List.

     

    I tried to modify as follow:

    If(
     CountRows(
     Filter(
     'Room Booking';
     And(
     'Date Start' >= DataCardValue2.SelectedDate;
     'Date End' <= DataCardValue3.SelectedDate;
     'Room' = DataCardValue4.Selected
     )
     )
     ) = 0;
     Notify("Room is already Booked on selected date"; NotificationType.Error);
     Reset(Self)
    )

     

    It also seems there is also an Error with the "=" in

    'Room' = DataCardValue4.Selected

     

    Regards

    Dario

     

     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 236 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 207 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 169

Last 30 days Overall leaderboard