cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Anonymous
Not applicable

PowerApps - Combining Sort and Search Functions

Hi,

 

I'm trying to create a search function that searches through the "Title" of a RSS feed and right now I only have the sort function for the publishDate of the RSS feed. Right now it searches for the publishDate:

 

SortByColumns(Filter(RSS.ListFeedItems("http://rss.cnn.com/rss/cnn_topstories.rss"),StartsWith(publishDate,TextSearchBox3_2.Text)),"publishD...", If(SortDescending1,Ascending,Descending))

 

 

I can also sort by "title" by changing 2 of the parameters:

 

SortByColumns(Filter(RSS.ListFeedItems("http://rss.cnn.com/rss/cnn_topstories.rss"),StartsWith(title,TextSearchBox3_2.Text)),"title", If(SortDescending1,Descending,Ascending))

 

Best,

km.

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: PowerApps - Combining Sort and Search Functions

Try this formula. It will all you to search by title and then sort the results by publishdate.

 

SortByColumns(
  Filter(RSS.ListFeedItems("http://rss.cnn.com/rss/cnn_topstories.rss"), 
    StartsWith(title, TextSearchBox3_2.Text)), 
  "publishDate", If(SortDescending1, Ascending, Descending)
)


--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

View solution in original post

7 REPLIES 7
Super User
Super User

Re: PowerApps - Combining Sort and Search Functions

Try this formula. It will all you to search by title and then sort the results by publishdate.

 

SortByColumns(
  Filter(RSS.ListFeedItems("http://rss.cnn.com/rss/cnn_topstories.rss"), 
    StartsWith(title, TextSearchBox3_2.Text)), 
  "publishDate", If(SortDescending1, Ascending, Descending)
)


--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

View solution in original post

Anonymous
Not applicable

Re: PowerApps - Combining Sort and Search Functions

Thanks Jeff! This solution is perfect. But I do have another question, what did changing "publishDate" do exactly? 

Super User
Super User

Re: PowerApps - Combining Sort and Search Functions

Based on the original post it sounded like you wanted to search on Title and sort by Publish date but the code examples you provided were both using the same fields in the StartsWith and SortByColumns functions. In my example I am using Title in the SatrtsWith function and then using "publishDate" in the SortByColumns function.



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.
Anonymous
Not applicable

Re: PowerApps - Combining Sort and Search Functions

That's exactly what I wanted to do! However I have another issue. For example, if the title of something was "Microsoft releases new app" and I type in "app", it won't appear because it's not searching through the whole title and only exact queries.

Super User
Super User

Re: PowerApps - Combining Sort and Search Functions

You can replace the startswith function with a "in" operator but that will give you the blue dot which means the query isn't delegable and can only be performed on the first 500 rows returned. If you have a small list this maybe ok.

 

Replace: StartsWith(title, TextSearchBox3_2.Text)), 

With: TextSearchBox3_2.Text in Title,


--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.
Anonymous
Not applicable

Re: PowerApps - Combining Sort and Search Functions

Thank you Jeff for your help!! You are a boss. Cat Very Happy

AnG3L
Level: Powered On

Re: PowerApps - Combining Sort and Search Functions

Hi,

 

I am having a similar issue combining Search and Startswith to sort my result set.

Due to the source I cannot use Filter and need to use search instead.

 

This is what I have so far but cannot get it working. I would like my result set to be sorted by the typed in search text. Eg. Client Name = Test

Currently it lists all clients with test in the name alphabetically I would like it list those that start with Test first.

 

SortByColumns(Search('[dbo].[Clients]',ClientSearchBox.Text,"name"),StartsWith(name,ClientSearchBox.Text),Ascending)

 

Is this possible? If so where am I going wrong with the above?

 

Thanks,

Angela

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 201 members 6,438 guests
Recent signins:
Please welcome our newest community members: