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 filter data t...
Power Apps
Answered

Dropdown filter data then search

(0) ShareShare
ReportReport
Posted on by 22

I have  a powerapp created from a  sharepoint list 'MCN_Plants5'. The following formula is attached to the Gallery: SortByColumns(Filter([@MCN_Plants5], StartsWith(Species, TextSearch.Text) || StartsWith('Common Name', TextSearch.Text)), "Title", If(SortDescending1, SortOrder.Descending, SortOrder.Ascending)) as per attached 1. This works OK but I have a delegation warning on searching by 'Common Name', which doesn't bother me.

 

I'd like to add a dropdown filter: Distinct(MCN_Plants5,'In the Nursery'), to search if the plants are in the nursery or not. How do I amend the gallery formula to accomodate the dropdown list filtering whether the plants are in the nursery ("Yes"} or not("No) please.

 

I am a relative newby, but I try hard. Thanks for your help.

MCN 2024-01-20 2.png
MCN 2024-01-20 1.png
Categories:
I have the same question (0)
  • Verified answer
    BhargavPatel Profile Picture
    660 Moderator on at

    Please try the code below. Replace "Dropdown1" with the name of your dropdown control.

    SortByColumns(
     Filter(
     [@MCN_Plants5],
     StartsWith(
     Species,
     TextSearch.Text
     ) || StartsWith(
     'Common Name',
     TextSearch.Text
     ) || TextSearch.Text = Blank(),
     'In the Nursery' = Dropdown1.Selected.Value || IsBlank(Dropdown1.Selected.Value)
     ),
     "Title",
     If(
     SortDescending1,
     SortOrder.Descending,
     SortOrder.Ascending
     )
    )

    I added conditions to show all items in the gallery if the search box is empty or nothing is selected from the dropdown. 

    Please accept this as a solution if it helped resolve your issue.

  • ANB Profile Picture
    7,252 Super User 2026 Season 1 on at

    Hi @Johno1 Does 'In the Nursery' is choice column? If yes, then try this:

    SortByColumns(Filter([@MCN_Plants5], 
    'In the Nursery'.Value = dropdownName.Selected.Value || IsBlank(dropdownName.Selected.Value),
    StartsWith(Species, TextSearch.Text) || StartsWith('Common Name', TextSearch.Text)), "Title", If(SortDescending1, SortOrder.Descending, SortOrder.Ascending))

    If , 'In the Nursery' is not choice column then below code should work:

    SortByColumns(Filter([@MCN_Plants5], 
    'In the Nursery' = dropdownName.Selected.Value || IsBlank(dropdownName.Selected.Value),
    StartsWith(Species, TextSearch.Text) || StartsWith('Common Name', TextSearch.Text)), "Title", If(SortDescending1, SortOrder.Descending, SortOrder.Ascending))

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

    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


  • JC-18030151-0 Profile Picture
    22 on at

    Thank you Bhargav. You have saved me a lot of trouble.

  • JC-18030151-0 Profile Picture
    22 on at

    Bhargav, thank you for solving my dropdown and search issue. Is it possible to include the "All" possibilty in the dropdown please? I am not good with formulae in a gallery. Thanks again for your help to date. John.

  • BhargavPatel Profile Picture
    660 Moderator on at

    Hi @Johno1. Here are the two ways to achieve that

     

    Option 1. If the only options you will need in the dropdown are "All", "Yes", or "No" then:

    • Change the dropdown Items property to

     

    ["All", "Yes", "No"]

     

     

    Option 2.

    • Set the OnVisible property of the screen to

     

    ClearCollect(inNursery,["All"],Distinct(Plants,'In the Nursery'))​

     

    • Change the dropdown Items property to

     

    inNursery

     

    After Option 1 or 2.

    • Change the Gallery Items property to 

     

    SortByColumns(
     Filter(
     [@MCN_Plants5],
     StartsWith(
     Species,
     TextSearch.Text
     ) || StartsWith(
     'Common Name',
     TextSearch.Text
     ) || TextSearch.Text = Blank(),
     'In the Nursery' = Dropdown1.Selected.Value || IsBlank(Dropdown1.Selected.Value) ||Dropdown1.Selected.Value = "All"
     ),
     "Title",
     If(
     SortDescending1,
     SortOrder.Descending,
     SortOrder.Ascending
     )
    )

     

     

     

    Please like the reply and accept it as a solution if it helps resolve your issue.

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 June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 342 Most Valuable Professional

#2
11manish Profile Picture

11manish 234

#3
Valantis Profile Picture

Valantis 187

Last 30 days Overall leaderboard