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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / DropDown in editform a...
Power Apps
Answered

DropDown in editform and newitem form

(0) ShareShare
ReportReport
Posted on by 252

Hey guys,

 

I'm trying to replace the default text input by a dropdown in an edit form and new item form of my application.

It's an inventory management app and basically the dropdown would return available categories (laptop, desktop, keyboard, mouse etc.) that are already in my table.

 

The idea is of course when I add a new item in stock, to assign a category to it using the dropdown instead of typing a random category in the text field....  I want to keep control not to have people creating lots of them (like: laptop, laptopS, PC etc). 

 

Any idea what formula could do the trick?

 

PLease check the screenshot.

 

Thank you so much!

 

 

 

dropdown.png
Categories:
I have the same question (0)
  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    Hi @AnthonyRegnier 

    You could use ["Laptop","Docking Station", "etc."] as the items property of your dropdown.  Make sure that the Update property of the card containing the dropdown reflects the change.  It should be something like Dropdown1.Selected.Value for that property.

    If you are adding stock items frequently and there aren't too many of them, you could add another connector like SharePoint or Excel on line to your app and use that as the Items property for the Dropdown. You could then add or modify the items from within PowerApps using a gallery and an edit form for that connector.

     

  • Verified answer
    AnthonyRegnier Profile Picture
    252 on at

    Hey mate,

     

    Thanks for your reply!

     

    Yeah I don't really want to hard code the values.

    I have actually another Dropdown in my gallery with something similar (a custom collection I believe) that I use to filter the results in my gallery but I can't use it as it contains an "All" record.

     

    On my gallery screen I have set the OnVisible property to:

    ClearCollect(colDropdownOptions, {Result: "All"});
    Collect(colDropdownOptions, Distinct('Stock Management',Description))

     

    Then, I just call "colDropdownOptions" from the dropdown list.

     

    So you're suggesting to do the same but from another screen (the EditForm screen and NewItem screen OnVisible Property) and call the collection from the dropdown? 

     

    Thanks

    Anthony

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    Hi @AnthonyRegnier 

    oops, sorry I accidently accepted your answer instead of reply.  You could filter the collection of Results to not show the All option. 

     

  • Verified answer
    AnthonyRegnier Profile Picture
    252 on at

    That sounds like a good idea.

     

    Would you be able to help me with the code?

     

    Cheers

    Anthony

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    Hi @AnthonyRegnier 

    You are going to have more problems if you base your dropdown on a Distinct() function. You will create problems for yourself trying to add or modify the current list of selections.  Create a new connection to a table of categories that you can modify and add new ones to.  To better understand the principles behind how a proper database is developed, check out my series https://powerusers.microsoft.com/t5/News-Announcements/Database-Design-Fundamentals-and-PowerApps-An-Overview/ba-p/184485 

  • AnthonyRegnier Profile Picture
    252 on at

    Hey @wyotim ,

     

    Unfortunately I haven't been able to solve that one even with the help of our colleague Drrickryp.

     

    Are you able to help ? I'm still cracking my head about this one...

     

    Cheers

    Anthony

  • wyotim Profile Picture
    2,545 on at

    So if I am understanding this correctly, you are wanting to make it so the dropdown is used in a form and doesn't contain the "All" value? For the latter, in the dropdown's Items property put:

    Filter(
     colDropDownOptions,
     Result <> "All"
    )

    To use that dropdown in a form, as @Drrickryp said earlier:  

    Make sure that the Update property of the card containing the dropdown reflects the change. It should be something like Dropdown1.Selected.Value for that property.

     The Update property is on the top level of the card (as opposed to on the dropdown itself or another object in the card). 

     

    To his point about having a separate list to control the inputs, this is great advice if you are able to do so. Things may work fine until you have a new type of item that a user needs to add that you maybe hadn't considered.

     

    If you aren't able to add a SharePoint list due to permission restrictions or something like that, you could try controlling it by allowing users to add a type to the collection and hope that another user isn't trying to add the same type of item. This way, they could add the type of item they need, write the data to SharePoint, and the Distinct would pick it up from there as it would then exist in your list.

     

    Doing this might require a bit of explanation so I will give you one high level approach. What I would do in this case would be to put an "Add Type" button (or the Add icon, etc.)  near the dropdown. This would be used to trigger a variable that would reveal an invisible box of them to enter text, along with a submit and a cancel button. Rather than explaining all of how to do that, I made a quick app to show the method. If you import this app, you should be able to see how it is done.

     

    I commented out the code to update the list in the OnSubmit property of the Submit button, just so you know. Also, I commented out some validation on the DisplayMode property so that people can't add item types that are already in the list and hid an error message in there to let them know (the Visible property is commented out on the error message). 

     

    Let me know if that gets you going in the right direction! If nothing else, maybe the attached app has something useful for a future scenario.

  • AnthonyRegnier Profile Picture
    252 on at

    Hey guys,

     

    Thanks again for taking the time to help here, really appreciate it. So as you know I have two one edit form that can open either for a current product that I have, or if I want to create a new one. The Filter you gave me to exclude "All" works great. It displays all the items in the "Description" column without duplicate (since this is the custom collection).

     

    So here is what I do: 

     

    1. I create the dropdown and place it in the card that shows the description 

    2. On the Item property of the DropDown I use the following code: Filter(colDropdownOptions, Result <> "All")

    3. On the Description_DataCard2, I change the code as you said to: Dropdown2.Selected.Result

    4. I render Unvisible the default text input that shows the value of the column for the item I'm looking for (DataCardValue10)

    5. When I change the DropDown value, it changes also the text input (expected I guess), then I hit save, it updates properly into SP.

     

    With this solution I am facing the following issues:

     

    Issue1:

    When I open a ProductDetail from my gallery and select "Edit", the DropDown I created does not show the value of the product. It always show "Laptop" which is the first one. How can we make the DropDown looking at "ThisItem.Description" ?

     

    Issue2: 

    If I have one type of Monitor, and I go to open this monitor product detail and select laptop as a category (just to try), the only "monitor item" I've got in the SP disappear, and then it disappear from the collection and I'm not able to roll it back (to assign back this item in the Monitor category)... That one is probably a bit tricky.... Maybe we can overcome by having a button that can create a new category?

     

    Could a Combobox help?

     

    Thank you so much guys..

    Anthony

     

     

     

     

  • AnthonyRegnier Profile Picture
    252 on at

    Hey guys!

     

    @wyotim , @mdevaney , any chance you can save me with this ? 😕

     

     

    Thanks

    Anthony

  • wyotim Profile Picture
    2,545 on at

    @AnthonyRegnier For issue one, you need to set it in the Default property of the dropdown. Forms set this structure up by default but when controls are added they need to be set up manually.

     

    For issue two, that sounds like a filtering issue or something like that. One thing I would suggest (though this probably won't fix the issue) would be to change the way you collect the Description list to this:

    If(
     IsEmpty(colDropdownOptions),
     ClearCollect(colDropdownOptions, {Result: "All"});
     Collect(colDropdownOptions, Distinct('Stock Management',Description))
    )

     

    This way, the list isn't being remade every time you navigate to that screen. 

     

    I don't think creating a new category would help, nor would using a combo box. Could you share the code you have on the items related to the process you described? This is on the form right? Maybe share the DataSource and Item properties of the form and we could start from there.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 541

#2
WarrenBelz Profile Picture

WarrenBelz 434 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 289

Last 30 days Overall leaderboard