Forum Discussion

Victoria Symons's avatar
Victoria Symons
Brass Contributor
May 14, 2022

Prevent double booking on choice col

Hi. I have a list which allows users to select a date and then book a desk. The desk column is a choice col and there are 4 choices (desks) available. Is there a way to prevent double booking of desks? I want each desk to be available for booking only once on a given day. 
I tried enforcing unique values in the list, but that only allowed 1 choice (desk) per day from the list. I need 4 choices per day. 
I am putting list into a powerapp, so maybe this can be controlled there?
Any help would be gratefully received. 

2 Replies

  • RobElliott's avatar
    RobElliott
    Silver Contributor

    Victoria Symons you can't do this with just SharePoint and Choice columns as SharePoint has no way to prevent double bookings. So you will need to build an app in Power Apps.

    For a desk booking app I built across multiple offices I had 2 SharePoint lists. One had the desk number, location and whether it was active or not (bosses kept changing which desks were available). The second list was to store all the bookings.

     

    One desk could be booked per day and on one of the screens there was a gallery. The items property checked whether a desk had already been booked out at that location for that day and didn't display it if so. It used the following syntax:


    SortByColumns(Filter(Desks,Not(Title in Filter(
    'Desk Reservations',
    CheckOutFrom = startTime).DeskText)
    && Active = 1
    && Location = selectedLocation), "Title" )

     

    There will obviously be differences in your app as you will have different columns and you might not need multiple locations. But it can be done and while the app was live we had over 5500 bookings and no duplicates.

     

    The original basis for the app was from a YouTube video by April Dunnam. I changed a lot but it was a very good start. The current version of that is at https://www.youtube.com/watch?v=JgvQjQsJa80&t=247s

     

    Come back with any questions.

     

    Rob
    Los Gallardos
    Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)

     

     

     

    • Victoria Symons's avatar
      Victoria Symons
      Brass Contributor

      RobElliott 

      Hi Rob,
      Thanks so much for taking the time to assist me. I have seen the video you mention. I’m afraid I am still stuck. I’m trying to create a simple desk reservation app with four desks, where each desk is bookable by the day. I have a list called ‘Desk Reservations’ which has the columns below. I do not need to include time and I’m not using the title field. The desks are in a choice column. 

      I’m trying to create a booking screen using a gallery to display the available desks, something like this.

      I’ve created a second list called Desks1 to do this and plugged it into a gallery as per the video and your instructions. The desks are stored in the title field.

      I’d like a booked desk to be removed from the gallery. But I have no clue how to get the desks1 list to interact with my desk reservations list. Or get the date picker to work. Or if this is even possible.
      I’ve watch a tonne of videos and I’m now more confused than ever.


      Any help you can give would be very much appreciated. Kind regards, Vicki

       

       

Resources