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

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to Add a Drop Down...
Power Apps
Unanswered

How to Add a Drop Down Menu to a Functional Search to Restrict Results?

(0) ShareShare
ReportReport
Posted on by

I have a functional Power App that displays a SharePoint list containing project data. I have a functional search field that searches three columns (Pursuit-Name, SFDC-ID, & Bid-Manager). I have added a drop down menu to further restrict search results based on the SharePoint created date. The SharePoint list only contains 2019 and 2020 projects and therefore the drop down will contain three items (all years, 2020, 2019).

How can I incorporate this drop down menu to work with the existing search function to further restrict the search results? 

 

My gallery is displaying the SP List data and the Items property contain the code shown below. I have one text input control that allows user to search either by Pursuit-Name, SFDC-ID, or Bid-Manager. Any recommendations are greatly appreciated.

 

SortByColumns(
 Filter(
 collTeamsSites, StartsWith( 'Pursuit-Name', txtSearch.Text ) || StartsWith( 'SFDC-ID', txtSearch.Text ) || StartsWith( 'Bid-Manager', txtSearch.Text ) 
 ) , "Title" 
)

 

 

Categories:
I have the same question (0)
  • eka24 Profile Picture
    20,923 on at
    Re: How to Add a Drop Down Menu to a Functional Search to Restrict Results?

    Try

    SortByColumns( Filter( collTeamsSites, StartsWith( 'Pursuit-Name', txtSearch.Text ) || StartsWith( 'SFDC-ID', txtSearch.Text ) || StartsWith( 'Bid-Manager', txtSearch.Text ) ,YearColumn=Dropdown1.Selected.Value) , "Title" )

     

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

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

  • Community Power Platform Member Profile Picture
    on at
    Re: How to Add a Drop Down Menu to a Functional Search to Restrict Results?

    Thanks @eka24  for the quick response!  I think your solution is close. I left out one detail. The SP List date created column contains the created date in the following format:  August 21, 2019

    I have the default property of the dropdown defaulting to 2020. when Power App first loads. 

     

    // Won't work since 'Created' date is in August 21, 2019  format

    SortByColumns( Filter( collTeamsSites, StartsWith( 'Pursuit-Name', txtSearch.Text ) || StartsWith( 'SFDC-ID', txtSearch.Text ) || StartsWith( 'Bid-Manager', txtSearch.Text ), 'Created' = Dropdown1.Selected.Value ) , "Title" )

     

    1. Since 'Created' is a SP date column/data type, how would I convert the Dropdown1.Selected.Value to just produce the year like yyyy?
    2. Also, will the gallery always update the search results when the dropdown is changed or do I have to add code to the "OnChange" property?

    Please advise.

  • eka24 Profile Picture
    20,923 on at
    Re: How to Add a Drop Down Menu to a Functional Search to Restrict Results?

    Try

    SortByColumns( Filter( collTeamsSites, StartsWith( 'Pursuit-Name', txtSearch.Text ) || StartsWith( 'SFDC-ID', txtSearch.Text ) || StartsWith( 'Bid-Manager', txtSearch.Text ), Text(Created,ShortDate)= Text(Dropdown1.Selected.Value,ShortDate ) , "Title" )

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

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

  • Community Power Platform Member Profile Picture
    on at
    Re: How to Add a Drop Down Menu to a Functional Search to Restrict Results?

    Thank you @eka24 for your response. Sorry for the slow reply but I got into another project.  

     

    Your post put me on the right track so now I have this which works. I have to extract just the year.  Is there a better/shorter way to do this? 

     

    SortByColumns(
    Filter(
    collTeamsSites,
    Right( Text( Created, ShortDate ), 4 ) = Right( Text( dropdownSiteCreatedYr.Selected.Value, ShortDate ), 4 ) &&
    (StartsWith( 'Pursuit-Name', txtSearch.Text ) || StartsWith( 'SFDC-ID', txtSearch.Text ) || StartsWith( 'Bid-Manager', txtSearch.Text ))
    ),
    "Title"
    )

  • Verified answer
    eka24 Profile Picture
    20,923 on at
    Re: How to Add a Drop Down Menu to a Functional Search to Restrict Results?

    SortByColumns(
    Filter(
    collTeamsSites,
    Year(Created)= Year( dropdownSiteCreatedYr.Selected.Value)&&
    (StartsWith( 'Pursuit-Name', txtSearch.Text ) || StartsWith( 'SFDC-ID', txtSearch.Text ) || StartsWith( 'Bid-Manager', txtSearch.Text ))
    ),
    "Title"
    )

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 836 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 231 Super User 2025 Season 2

Last 30 days Overall leaderboard