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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Canvas App Search and ...
Power Apps
Unanswered

Canvas App Search and Sort by column for multiple columns.

(0) ShareShare
ReportReport
Posted on by 2

I am using a Canvas App based on SharePoint List and trying to combine Search and SortByColumn using multiple columns. Specifically, I want to allow the user to type in the search box and results are returned from multiple columns. 

 

Here is the code that works:  SortByColumns(Filter([@SharePointListName], StartsWith(Title, Search_Box.Text)), "Title", If(SortDescending1, Descending, Ascending)).

 

Note that this code sorts on only one column.  I would like also to Search (or perhaps Filter) on "City" and "Name" in addition to the "Title" column. 

 

What am I missing?  Is this possible? 

Thanks for any suggestions!

Categories:
I have the same question (0)
  • CU-18081211-6 Profile Picture
    9,270 Moderator on at

    @GeoMapper,

    Is this approach suitable to your needs ? 

    SortByColumns(
     Filter([@SharePointListName], 
     StartsWith(Title, Search_Box.Text)||
     StartsWith(City, Search_Box.Text)||
     StartsWith(Name, Search_Box.Text)
     ), "Title", 
    If(SortDescending1, Descending, Ascending)
    )

     

  • Pstork1 Profile Picture
    68,697 Most Valuable Professional on at

    You can sort by additional columns by adding them and the direction after the first column you sort.  So to sort by Title, and then City it would be the following.

    SortByColumns(Filter([@SharePointListName], StartsWith(Title, Search_Box.Text)), "Title", If(SortDescending1, Descending, Ascending), "City", If(SortDescending2, Descending, Ascending))

    For Name, just add a third set of entries.

  • v-qiaqi@microsoft.com Profile Picture
    on at

    Hi @GeoMapper,

    Do you want to sort and search for multi columns?

    Could you please tell me that if you want to input strings related to City, Name, Title in a single search box or multi search boxes?

     

    A single search box only supports one search column, if you want to search strings based on multi columns, I think you should add more search boxes

    SortByColumns(
    Filter(
     Filter(
     Filter(Table,
     StartsWith(Title,TextInput1.Text)
     ), 
     StartsWith(Name,TextInput2.Text)
     ),
     Startswith(City, TextInput3.Text)
     ),
    "Title","Name","City",
    If(SortDescending1, Descending, Ascending)
    )

    Of course, if you want the search strings from all the column, you should modify the above as below:

    SortByColumns(
     Filter(Table,
     StartsWith(Title,TextInput1.Text) ||
     StartsWith(Name,TextInput2.Text) ||
     Startswith(City, TextInput3.Text)),
    "Title","Name","City",
    If(SortDescending1, Descending, Ascending)
    )
  • GeoMapper Profile Picture
    2 on at

    Thanks for your responses! @v-qiaqi-msft ; @Pstork1 ; @gabibalaban I had the similar thought as Qi about one search box for each column.  Not the feature I wanted, but may work for the users. I also received a error "

     

    The other two options did not work as planned.  I am a novice at Power Apps, but I'll do my best to explain the issues.  When using gabibalban's suggestion:  I have one Performance Warning - Data row limit for non-delegable queries is more than 500.  I less than 200 rows in my SharePoint table.  The symptom checker says to change this in App - Advanced, but I do not see this option. 

    Two other options are indicating formula problems that I do not have when I use the formula I provided previously.    

    1.  Unexpected characters - The parentheses around the Filter command are highlighted as well as each instance of "Search_Box.text".

    2.  Name isn't valid.  This identifier isn't recognized. And Invalid use of "." for the Browse Gallery Title1, Text=ThisItem.Title.

     

    I have not been able to figure out why the first formula has worked perfectly for months, but using formulas suggested (and other similar ones I have tried in the past) have so many problems, unless it is the limit on columns the search box can use.  

     

    Thanks again for your assistance.  

     

     

  • v-qiaqi@microsoft.com Profile Picture
    on at

    Hi @GeoMapper,

    Could you please provide a screenshot to display the error message?

     

    To the issue that you could not find the data row limit settings, please check the following screenshot:

    vqiaqimsft_0-1635472991710.png

     

    For your two error, please tell me that how you write your formula in the formula bar and do provide a screenshot.

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 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard