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 / Logic to lock out options
Power Apps
Unanswered

Logic to lock out options

(0) ShareShare
ReportReport
Posted on by 108

Good morning all, I have asked this question before but I am having to ask it again. I have an app for exam registration. 

pgeory_0-1705915746813.png

Our exams officer can create an event/exam with the following information. once submitted it is displayed like this.

 

pgeory_1-1705915887090.png

An invigilator can then click on the register button and can choose from the role that they want to do see below. 

pgeory_2-1705916007188.png

I have now registered for the reader scribe and notice that it is showing that on the screen below.

 

pgeory_3-1705916074736.png

 

What i would like to happen now is if someone else goes to register for this exam the option for reader/scribe is no longer available because its limit has been reached and the same for all the other options. Can anyone please provide me with a dummies guide on how i can achieve this. The data is being displayed in 2 different sharepoint lists. this is the list where the exam details are stored.

pgeory_4-1705916245531.png

 

and this is the list for when someone registers for the exam

pgeory_5-1705916331413.png

 

Categories:
I have the same question (0)
  • AR-29081311-0 Profile Picture
    137 on at

    Hi @pgeory ,

     

    I don't think it is possible or I am not aware on how to make a Choice column option from SharePoint "no longer available" as it will remain an option in the backend, therefore always pulling into the dropdown column. 

     

    You will need to handle the logic on the Save button. Or you could display a label when the user selects an option and the limit has been reached.

     

    For example: 
    1. Put a label under your dropdown with text "The limit for this role has been reached!"

    2. Set the visible property to: showLabel

    3. Add code onSelect of the Dropdown that retrieves the limit from your Exam column, Checks how many people have currently registered for that role and then does the logic to hide/show the label.
    4. You may want to use this logic on the displaymode of your save button also to disable the option to save if the limit has been reached.

     

    This may not be entirely correct but you can make adjustments to suit your lists: 
    OnSelect of Dropdown Code: 

    // When a role is selected from the dropdown
    OnSelect = 
     // Get the selected role
     Set(selectedRole, Dropdown.Selected.Role);
     
     // Get the limit for the selected role from the 'Exams' list
     Set(roleLimit, LookUp(Exams, Title = selectedRole).Limit);
     
     // Get the number of existing registrations for the selected role
     Set(existingRegistrations, CountRows(Filter(ExamRegistrations, Role = selectedRole)));
     
     // Check if the limit has been reached
     If(existingRegistrations >= roleLimit,
     // If the limit has been reached, display a label
     Set(showLabel, true),
     // If the limit has not been reached, hide the label
     Set(showLabel, false)
     )

     

    Hope this helps!

     

    Aaron

  • Feline Profile Picture
    92 on at

    Hi @pgeory 

     

    If I understand it correctly you want to filter the choices based on certain roles that are still required or not.

     

    I always like to start by looking at the information that is available and find the logic accordingly.

    What you know:

    • In this case you have the requirements in one list and the registrations in a second one.
    • This means that somehow you will most likely have to filter the second list based on known information to the two lists. In this case it could be the ExamID.
    • On the default form the choices from SharePoint are retrieved from the second list, default without any filtering

     

    What you could do is create a temporary collection with the roles that are still required. For this you could check the filtered amount registered against the required. For example, if the filtered amount is smaller than the required, collect it to the temporary collection, like this:

    If(

        CountRows(Filter(Registrations, ExamID = Gallery1.Selected.'Exam ID' && Role.Value = "Lead")) < Value(Gallery1.Selected.'Lead Invigialtor'),
        Collect(col_Options, {Value: "Lead"})

    );

    Depending on how you retrieved the registered amount in your overview screen, you could possibly reuse your own code.

     

    Once you have the temporary collection you can filter the SharePoint choices based on that temporary list. For example as follows:

    Filter(Choices([@Registrations].Role), Value in col_Options.Value)

     

    This might not be the most performant way, but it gives you an idea of how you could create some logic yourself.

    I hope this helps.

  • pgeory Profile Picture
    108 on at

    I am ot using dropdown I am using a datacard as i have it as form from sharepoint, does that make a difference. Sorry i am new to this and maybe bit off more than i could chew. Also do i put the code on the role datacard?

  • Feline Profile Picture
    92 on at

    Hi @pgeory 

     

    If you unlock the datacard for role on the properties panel, do you get something like this?

    Choices([@YourList].Role

     

  • pgeory Profile Picture
    108 on at

    I get Items Choices([@'Exam Registration'].Role)

  • Feline Profile Picture
    92 on at

    Hi @pgeory 

     

    Great, this means that you get all the choice options from SharePoint.

    So, this contains all the possibilities, now we need to adjust these options based on the roles we still need.

     

    As a test we can try to put these roles in a separate collection.

    To build this collection we need some way to check whether we have enough registered users per required role.

    How do you retrieve the number of registered users per role in your overview screen?

  • pgeory Profile Picture
    108 on at

    pgeory_0-1705998828728.png

     

  • pgeory Profile Picture
    108 on at

    Where would i put this code?

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 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard