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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Remove options on a dr...
Power Apps
Unanswered

Remove options on a dropdown if it is already selected and patched in Sharepoint

(0) ShareShare
ReportReport
Posted on by

Hi Guys,

 

I am currently working on a booking system, I need help in disabling or removing options in a dropdown if a certain time is already booked for the day, I have set the time with 30 minute intervals and I like to have the options gone once the times were booked for the same day (e.g., I booked a schedule for 9/8/2023, 1PM-3PM, I need the hours for the same day disabled or removed if there is someone still booking for the same day) I have 2 drop downs for start time and end time for them to select how long their booking is. 

Categories:
I have the same question (0)
  • Michael E. Gernaey Profile Picture
    53,315 Super User 2025 Season 2 on at

    Hello,

     

    My recommendation is

    1. create two collections for start and stop time dropdowns (note) I am assuming that as people load this, you need to figure out which times are already used and then use the Remove function to get rid of those in the UI.

     

    2. as people select times use Remove(duplicateCollection, TimeValue = AlreadySelectedValue) when one gets scheduled

     

    Since the Start and Stop time Items properties are set to these duplicate collections, as soon as one gets removed it will go away from the dropdown.

     

    The only thing I see if, what if multiple people are doing this at the same time, and one person has been sitting there a few minutes and doesn't realize that a time has been used, because the UI won't know it (for them), you'll have to make sure on the back end that you validate that the time isn't used, and send back and update set of values (or make them reload the dropdown with available times).

     

    So your big issue is, you won't easily be able to show stuff that is "gone" unless you use like a timer to check and update the collections behind the scenes, or as mentioned, when they submit, it will fail, then update.

     

    Also, depending on how you do this you wont need #1, you'll only need to create the two collections

  • VinChua Profile Picture
    on at

    What if I have the choices as static and not coming from a datasource? would the remove function still work? and what property should I put that in? thanks!

  • uwenagel Profile Picture
    382 on at

    I have done this the following way:

     

    Create a collection of the items already selected. This has to be done when loading the screen.

     

    You have to recollect whenever there is a new selection made to keep this list updated.

     

    This means that you need any selection criteria in the list of available items.

    Then you filter the available items for the dropdown by something like:

     

    Filter(tbl,Not(sel in collection))

     

    with

    tbl the source for the dropdown options

    sel the selector criteria if an option is already selected

    collection the list of items already selected

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • VinChua Profile Picture
    on at

    Thanks! I'll try to do this, another question is, how can I remove previous dates from the collection so that the collection won't get big enough to affect the application's loading time

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 793 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 333 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard