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 / Room booking system
Power Apps
Unanswered

Room booking system

(0) ShareShare
ReportReport
Posted on by 18

Hello,

I'm trying to build a room booking app from scratch (no template).

 

I created two Sharepoint Lists, the first one is Room which contains the possible rooms.

The second is ReservationRoom. This list allows to display which room has been booked with datetime (DatetimeStart and DatetimeEnd).

 

The room booking is working, you select the room in a gallery, then you select your booking datetime Start/End with a form.

 

Now I would like to put a system where when you select a room and a datetime, a checking is made in order to find if the selected room and DatetimeStart, DatetimeEnd are available.

I guess I have to compare DatetimeStart & DatetimeEnd in SharePoint list to those selected.

 

My sharepoint Room list:

 

Room list powerapps.PNG

 

My sharepoint ReservationRoom list: 

 

reservationRoom list sharepoint.png

 

Can anyone help me out?

Thank in advance !

Categories:
  • v-qiaqi@microsoft.com Profile Picture
    Microsoft Employee on at

    Hi @khellaf_,

    Do you want to book during a date range?

    Could you please tell me if you have a form to submit the form?

     

    If you want to book during a date range and check if there is available slot using a form, you could validate the booking conflict by setting the submit button OnSelect as below:

     

    If(!IsBlank(LookUp(ReservationRoom,
     (DebutDate<= DatePicker4.SelectedDate && FinDate> DatePicker4.SelectedDate) || 
     (DebutDate< DatePicker5.SelectedDate && FinDate>= DatePicker5.SelectedDate) || 
     (DebutDate< DatePicker4.SelectedDate && FinDate> DatePicker5.SelectedDate))),Notify("Not available for booking!",Error),SubmitForm(Form1))

     

    DatePicker4 represents the DatetimeStart date picker and DatePicker5 represents the DatetimeEnd date picker. If you have the time picker, you should modify as below:

    HourDropdown:

    Items property (24 hours):

     

    ["00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23"]

     

    MinutesDropdown:

    Items property:

     

    ["00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56","57","58","59"]

     

    Together with the DatePicker control, within one DataCard, then use the following formula to combine the time value with the date value under the Update property of the DataCard control:

     

    DateValue1.SelectedDate + Time(Value(HourDropdown.Selected.Value), Value(MinutesDropdown.Selected.Value), 0)

     

    You just need to replace DatePicker4 with the above time format and so does the DatePicker5

     

     

  • khellaf_ Profile Picture
    18 on at

    Hi,

    Thank you for your help @v-qiaqi-msft

    Yes I'm using a form.

     

    My gallery with room selector: 

    gallery selector.PNG

    My form: 

     

    form.PNG

    My submit form: 

    submit.PNG

     

  • v-qiaqi@microsoft.com Profile Picture
    Microsoft Employee on at

    Hi @khellaf_,

    Could you please try my solution and check if it works on your side?

    I have provided the detailed steps.

  • khellaf_ Profile Picture
    18 on at

    Hello @v-qiaqi-msft !

    I tried the solution and the date range comparison is working, thank you.

    However, the issue is the date checking is for all rooms.

    I would like to display the error message only if the chosen Room is already booked relative to a specific date.

  • v-qiaqi@microsoft.com Profile Picture
    Microsoft Employee on at

    Hi @khellaf_,

    That's easy to achieve. You just need to add a condition within the LookUp() function. 

    How you select a special room, using a Combo Box?

     

    You just need to 

    If(!IsBlank(LookUp(ReservationRoom,
     (DebutDate<= DatePicker4.SelectedDate && FinDate> DatePicker4.SelectedDate) || 
     (DebutDate< DatePicker5.SelectedDate && FinDate>= DatePicker5.SelectedDate) || 
     (DebutDate< DatePicker4.SelectedDate && FinDate> DatePicker5.SelectedDate),Self.Text=Room.Value)),Notify("Not available for booking!",Error))

    Note that this formula needs to be set for each room selector button OnSelect property. Self.Text represents the selected room name.

  • khellaf_ Profile Picture
    18 on at

    @v-qiaqi-msft 

    It's a gallery which contains buttons to select, that's not a Combo Box.

    I tried this formula and put Self.Text OnSelect but the Error notification shows up again.

    Self.Text=Room.Value

     

    formula.PNG

  • khellaf_ Profile Picture
    18 on at

    @v-qiaqi-msft 

    Any news?

  • v-qiaqi@microsoft.com Profile Picture
    Microsoft Employee on at

    Hi @khellaf_,

    I have asked you that how you select a room, you told me you use a Gallery, but I want to know what formula you use to represent a selected room?

     

    In my formula, you just need to modify the Self.Text with the formula you used to represent the selected room from a Gallery.

     

    Hope this could help you at some degree.

     

  • khellaf_ Profile Picture
    18 on at

    Hi @v-qiaqi-msft.

    Unfortunately, your formula doesn't work.

    With the formula you gave me previously , I tried this to Items Gallery : 

     

    LookUp(ReservationRoom,
     (DebutDate<= DatePicker4.SelectedDate && FinDate> DatePicker4.SelectedDate) || 
     (DebutDate< DatePicker5.SelectedDate && FinDate>= DatePicker5.SelectedDate) || 
     (DebutDate< DatePicker4.SelectedDate && FinDate> DatePicker5.SelectedDate))

     

    I can show which room(s), is/are not available for booking

     

    khellaf__0-1666084730843.png

     

    khellaf__1-1666084868456.png

     

    But now I would like the opposite condition, which room(s) is/are available.

    Could you help me?

    Thank you in advance.

     

     

     

  • v-qiaqi@microsoft.com Profile Picture
    Microsoft Employee on at

    Hi @khellaf_,

    To get the rooms which are available, you just need to add a Not before the condition.

    LookUp(ReservationRoom,
     Not((DebutDate<= DatePicker4.SelectedDate && FinDate> DatePicker4.SelectedDate) || 
     (DebutDate< DatePicker5.SelectedDate && FinDate>= DatePicker5.SelectedDate) || 
     (DebutDate< DatePicker4.SelectedDate && FinDate> DatePicker5.SelectedDate)))

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 345 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 312

#3
Mohsin Ali Profile Picture

Mohsin Ali 252

Last 30 days Overall leaderboard