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 / Add an "All" to your D...
Power Apps
Answered

Add an "All" to your Dropdown Lists - Dynamically- not working as planned

(0) ShareShare
ReportReport
Posted on by 221

I am trying to add an all to my drop down. But it is saying that I did something wrong. 

 

With({lclProviderName: Choices(D_PROVIDER.provider_name)},
ForAll(Sequence(CountRows(lclProviderName)+1), {Value: If(Value=1, "All", Last(FirstN(lclProviderName, Value-1).Value)})
)

 

 

Add an all to your Dropdown Lists.PNG
Categories:
I have the same question (0)
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @NitroPepsi 

    That's almost the exact title to my video on doing this process! 😁

     

    Your formula is correct.  Is this a SharePoint list?

    With({lclProviderName: Choices(D_PROVIDER.provider_name)},
     ForAll(Sequence(CountRows(lclProviderName)+1), 
     {Value: If(Value=1, "All", Index(lclProviderName, Value-1).Value)}
     )
    )

     

    You can also use this formula: 

    Ungroup(
     Table({Items: ["All"]},
     {Items: Choices(D_PROVIDER.provider_name)}
     ),
     "Items"
    )

     

    What error are you getting?

  • NitroPepsi Profile Picture
    221 on at

    Hi, no it is Microsoft SQL server for the data source.

    The first error it is giving me is choices has invalid arguments and Name isn't valid. {0} isn't recognized. 

     

    in the lower portion of this it is saying last has some invalid arguments . Incompatible type. We cant evaluate your formula because of a type error.

    NitroPepsi_0-1663273849657.png

     

    For this formula, the choices command is not feeling it.  I did try to put in my primary key but it still was not feeling it. 

    Ungroup(
     Table({Items: ["All"]},
     {Items: Choices(D_PROVIDER.provider_name)}
     ),
     "Items"
    )

     

     

    Type Error.png
    Choices.png
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @NitroPepsi 

    Yes, choices is not a valid function for SQL data as there is no Choice (or complex) type columns in it!

     

    What is it that you are trying to get out of your table?  All the provider_name records?  A Distinct list of them?

     

  • NitroPepsi Profile Picture
    221 on at

    See, I was originally using this formula for my dropdown - Distinct('[incentive_test].[D_eTime]', Employee_Display_Name) 

     

    To filter people in a gallery

     

    SortByColumns(Search(Filter('[incentive_test].[D_eTime]', DELETE_IND = "N", Employee_Display_Name= Dropdown1.SelectedText.Value),'Search Bar Table of Sub'.Text, "Employee_Display_Name"),"ImportMonth", Descending, "Employee_Display_Name", Ascending)

     

    But the problem is that the first name on the drop down is the name that it shows in the gallery. So instead of showing all the names in the gallery it shows the first name. Similar to your video, how in the end, the default was all and it showed everyone in the gallery. That is what I am trying to do is show everyone or have the all in the gallery and then the individual is able to select their name and it filter their name from the drop down. 

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @NitroPepsi 

    So, first thing...you are using SelectedText in your second formula.  That is a deprecated Property and should be avoided.  Use the proper Selected.<columnName> instead!

     

    You can add the All to the Distinct list formula.

    Ungroup(
     Table({Items: Table({Result: "All"}) },
     {Items: Distinct('[incentive_test].[D_eTime]', Employee_Display_Name)}
     ),
     "Items"
    )

     

    To clear up the SelectedText issue, your formula for that would then be:

    SortByColumns(
     Search(
     Filter('[incentive_test].[D_eTime]', 
     DELETE_IND = "N", 
     Employee_Display_Name = Dropdown1.Selected.Result
     ),
     'Search Bar Table of Sub'.Text, "Employee_Display_Name"
     ),
     "ImportMonth", Descending, "Employee_Display_Name", Ascending
    )
  • NitroPepsi Profile Picture
    221 on at

    Thank you for your assistance in this! It worked, I just needed to update my formula in the gallery to this 

     

    SortByColumns(Search(Filter('[incentive_test].[D_eTime]', DELETE_IND = "N", Employee_Display_Name= Dropdown1.Selected.Result || Dropdown1.Selected.Result="All"),'Search Bar Table of Sub'.Text, "Employee_Display_Name"),"ImportMonth", Descending, "Employee_Display_Name", Ascending)

     

     

    Just one more question for you the ascending, portion, it does not like it, where can I put this to make it work?

    ngroup(
    Table({Items: Table({Result: "All"}) },
    {Items: Distinct('[incentive_test].[D_eTime]', Employee_Display_Name)}
    ),
    "Items", Ascending
    )

  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @NitroPepsi 

    You would not want to sort the entire table after you add the ALL to it...otherwise it could possibly put your ALL someplace else in the list alphabetically.

     

    Instead, sort the Distinct table...

    Ungroup(
     Table({Items: Table({Result: "All"}) },
     {Items: Sort(Distinct('[incentive_test].[D_eTime]', Employee_Display_Name), Result)}
     ),
     "Items"
    )

    You don't even need to specify the Ascending in the Sort...it is the default, so if you don't include it, it will be ascending.

  • NitroPepsi Profile Picture
    221 on at

    Thank you so much! 

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @NitroPepsi 

    Happy to help! 😁

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 345 Most Valuable Professional

#2
11manish Profile Picture

11manish 207 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 177

Last 30 days Overall leaderboard