Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

want to hide a dropdown if it is selected already

(1) ShareShare
ReportReport
Posted on by 101

I'm working with an app where I want to hide a dropdown value if it's already selected in another row..

karthik26_0-1697549196101.png

for example, i want to hide winch drum in dropdown, because it was selected in 1st row.

  • Del-Dev Profile Picture
    160 on at
    want to hide a dropdown if it is selected already
     
    Hi @ANB,
    That was a great suggestion to hide an item in the dropdown in the 2nd row if it was selected in the first row of the gallery! But I have a few questions. In your suggestion, the code that you have provided has this expression:
     
    Collect(
     col_Main,
     {Value: ""}
    );
    What is the {Value: ""} for?
     
    Secondly, in your 2nd code provided: 
    ClearCollect(
     col_ForDropdown,
     Table(
     {
     Value: "A",
     Added: false
     },
     {
     Value: "B",
     Added: false
     },
     {
     Value: "C",
     Added: false
     },
     {
     Value: "D",
     Added: false
     },
     {
     Value: "E",
     Added: false
     },
     {
     Value: "F",
     Added: false
     },
     {
     Value: "G",
     Added: false
     }
     )
    );
    May I know what is the Table for? Is it a list of items in the dropdown box but in a form of a table? In my context, I have an array of items in the "Item" property and is illustrated as follows:
    ["Boat", "Car", "Train"]. Based on your provided suggestion illustrated above, how can I make it work in my context to hide an item in the dropdown box in the 2nd row if the same item is selected in the dropdown in the 1st row?
     
     
  • Verified answer
    ANB Profile Picture
    7,075 Super User 2025 Season 1 on at
    Re: want to hide a dropdown if it is selected already

    Hi @karthik26 , Basically, I have 2 collections: col_Main and col_ForDropdown. 

    col_Main: This is used as Item property of your gallery. In your case it will be same data source or collection that you are creating on click on Add button.

    col_ForDropdown: This is used as Item property of dropdown, but in different way.

     

    OnSelect of Add button, I have below code:

    Collect(
     col_Main,
     {Value: ""}
    );

    OnVisible of Screen, i have this code: In your case it should be items that you might be pulling it from some source with distinct values. In top of that I have added one more column named as Added.

    ClearCollect(
     col_ForDropdown,
     Table(
     {
     Value: "A",
     Added: false
     },
     {
     Value: "B",
     Added: false
     },
     {
     Value: "C",
     Added: false
     },
     {
     Value: "D",
     Added: false
     },
     {
     Value: "E",
     Added: false
     },
     {
     Value: "F",
     Added: false
     },
     {
     Value: "G",
     Added: false
     }
     )
    );

    Now the AllowEmptySelection is true for dropdown which is within your gallery.

    The Default of dropdown is ThisItem.Value

    OnChange Property of dropdown is 

    Update(
     col_Main,
     ThisItem,
     {Value: Self.Selected.Value}
    );
    Update(
     col_ForDropdown,
     LookUp(
     col_ForDropdown,
     Value = Self.Selected.Value
     ),
     {
     Value: Self.Selected.Value,
     Added: true
     }
    );

    NOTE: col_Main collection, I have only one column Value, in your case you need to have all columns which is required.

    And the Item property of your dropdown will be:

    If(
     ThisItem.Value in col_ForDropdown.Value && LookUp(
     col_ForDropdown,
     Value = ThisItem.Value
     ).Added = true,
     col_ForDropdown,
     Filter(
     col_ForDropdown,
     Added = false
     )
    )

    So basically, I am patching the selected value as true in Added column and then based on selection , I make the Item property dropdown in conditional way.

     

    Again, you need to work on this code as per your requirement.

     

    -----------------------------------------------------------------------------------------------------------------------------

    I hope this helps.

    Please click Accept as solution 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 Thumbs up.👍

    Thanks,
    ANB


     

  • ANB Profile Picture
    7,075 Super User 2025 Season 1 on at
    Re: want to hide a dropdown if it is selected already

    Hi @karthik26 , Please confirm whether this is what you are looking:

    ANB_1-1697556002907.gif

    If yes, then it is little tricky but I can explain the code and you might have to manage it according to your own code.

     

    I am also using gallery and within that the dropdown.

    -----------------------------------------------------------------------------------------------------------------------------

    I hope this helps.

    Please click Accept as solution 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 Thumbs up.👍

    Thanks,
    ANB


  • karthik26 Profile Picture
    101 on at
    Re: want to hide a dropdown if it is selected already

    Sorry, i will explain clearly.

    I have a gallery where I enter measurement data. The data is saved to SharePoint.

    the data source of a gallery is a collection(colactualdia), on visible to screen this collection is created.

    ClearCollect(
    colactualdia,
    'GOM L&H-Wire Rope Actual Diameter'
    );

    i have added a dropdown and text inputs in gallery were user will enter the measurements. 

    for dropdown items propert i used.

    karthik26_1-1697553860722.png

     

     

    i used a button called ADD to adda new blank row in gallery.

    karthik26_0-1697553765904.png

     

    What i want is hide the value in dropdown , in next row once user is selected it in some other row.

    karthik26_2-1697554018841.png

    i want to hide gantry sheave 1, in dropdown value  of next row. Because it is already selected .

  • Rajkumar_M Profile Picture
    3,614 Super User 2025 Season 1 on at
    Re: want to hide a dropdown if it is selected already

    Hi @karthik26 

     

    Utilize the collection function in the OnChange property of the first Dropdown control to gather items with values that are not equal when select in first dropdown.

     

    ClearCollect(
    filterdrp,
    Filter(
    Datasource,
    !(Dropdown1.Selected.Value in Choicecolumn.Value)
    )
    )


    2nd dropdown item property : filterdrp

     

    drpdown.png


    This may help you.

    Thanks!

     

    If my response has been helpful in resolving your issue, I kindly request that you consider clicking "Accept as solution" and "giving it a thumbs up" as a token of appreciation.

  • karthik26 Profile Picture
    101 on at
    Re: want to hide a dropdown if it is selected already

    i think you got it wrongly.

     

    Want i want is if any value selected in dropdown(Winch drum) already, i want that particular value(winch drum) to hide from dropdown.

  • Anchov Profile Picture
    1,984 on at
    Re: want to hide a dropdown if it is selected already

    To do this, you will need to make sure that your drop down selection allows Empty selection:

    Anchov_0-1697550771731.png

    Clear out the Default property

    Anchov_1-1697551133930.png

    Then, Set the Visible Property to 

    Len(Self.Selected.Value) = 0

     


    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.

    Cheers!
    Rick Hurt

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,524 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,906 Most Valuable Professional

Leaderboard