Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Unanswered

Managing items with a Dropdown in a gallery

(1) ShareShare
ReportReport
Posted on by 16
I have a dropdown column in a Power Apps gallery with three choices Red, Blue and Green. The user can select maximum two Red out of all items in the gallery, the rest of the items must have either Blue or Green selected. On save of the gallery this column is saved in a Single line of Text column called Color in a Dataverse Table.
 
The user should be able to change the color of any row any time but the maximum rows with selected Red will never be more than two.  Rest must be Blue or Green. The user should be able to change the color in the Gallery items in future also with the condition being that maximum row with Red cannot be more than two.
 
How best to achieve this.... 
 
 
 
 
 
Categories:
  • WarrenBelz Profile Picture
    146,645 Most Valuable Professional on at
    Managing items with a Dropdown in a gallery
    Just following up to see if you received the answer you needed, or if you require further assistance.

    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)     Visit my blog Practical Power Apps    Buy me a coffee
  • WarrenBelz Profile Picture
    146,645 Most Valuable Professional on at
    Managing items with a Dropdown in a gallery
    Hi​​​​​​​ jaimat1
    Using a Combo Box (not a drop down), put this OnChange
    UpdateContext(
       {
          varRed: 
          CountIf(
             GalleryName.AllItems,
             ComboBoxName.Selected.Value = "Red"
          )
       }
    )
    Then the Items
    If(
       varRed = 2,
       [
          "Blue",
          "Green"
       ],
       [
          "Red",
          "Blue",
          "Green"
       ]
    )
    and at Screen OnVisible or anywhere else you need to reset it
    UpdateContext({varRed: 0})
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)     Visit my blog Practical Power Apps    Buy me a coffee
  • ronaldwalcott Profile Picture
    3,515 on at
    Managing items with a Dropdown in a gallery
    It seems that you have to keep track of how many items are red. You can maintain a count in a configuration table which you will read when you open the screen containing the gallery or you can count the number of red items when you open the screen. 
    When you change an item's colour you should disable the red option if the maximum of red items has been reached. Before saving colour changes you need to ensure that no one else has already changed the items.  

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,645 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,997 Most Valuable Professional

Leaderboard