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 / Filter and sortby column
Power Apps
Unanswered

Filter and sortby column

(0) ShareShare
ReportReport
Posted on by 792
I have a gallery and text input on a screen. 
 
On the gallery items I have:

If(

   IsBlank(TextInput.Text),

   SortByColumns('2nd Stage Reviews', "Created", Descending),

   SortByColumns(

       Filter('2nd Stage Reviews', StartsWith(field_3, TextInput.Text)),

       "Created",

       Descending

   )

)
 
 
Ultimately I want it to show the latest 200 rows from the dataset plus filter by the gallery by the text that is entered into the text input, however the  filter is not always working it works with some text that is entered and not others, is there a logical reason for this happening?
Categories:
I have the same question (0)
  • Suggested answer
    Vahid Ghafarpour Profile Picture
    697 Super User 2025 Season 2 on at
    StartsWith is delegable only for certain data sources and fields.
    When Power Apps hits a non-delegable function, it only pulls the first 500–2000 records locally, depending on app settings.
    So if the matching value isn’t in the first batch, the Filter() won't find it, even if it exists in the dataset.
     
     
    I'd use Search instead of StartsWith
  • WarrenBelz Profile Picture
    153,034 Most Valuable Professional on at
    Hi @Kmayes,
    Firstly, if field_3 is a Single Line of Text, then StartsWith is certainly Delegable, so that is not your issue. Also note that Search is not Delegable, so that will only compond the issue.
    Also your sorted filter will display the newest records first, so the newest 500 will be there at the top. You can condense the code a bit like this if you want to use StartsWith - note that this code below is Delegable.
    SortByColumns(
       Filter(
          '2nd Stage Reviews', 
          Len(TextInput.Text) = 0 ||
          StartsWith(
             field_3, 
             TextInput.Text
          )
       ),
       "Created",
       SortOrder.Descending
    )
    However to your question - I assume you realise that StartsWith only shows field values starting with the text entered by the user (not fields with the text anywhere in them), so what type of queriesis it not working on and how many records are in your List ?
  • Kmayes Profile Picture
    792 on at
     
    Field_3 was a number column therefore I amended the formula slightly and it now seems to work after some testing, thanks for your response however
     
    If(
       IsBlank(TextInput.Text),
       SortByColumns('2nd Stage Reviews', "Created", SortOrder.Descending),
       SortByColumns(
           Filter(
               '2nd Stage Reviews',
               field_3 = Value(TextInput.Text)
           ),
           "Created",
          SortOrder. Descending
       )
    )
  • WarrenBelz Profile Picture
    153,034 Most Valuable Professional on at
    Hi @Kmayes,
    Good to see if working, but a bit hard to guess the solution based on your post . . .
    You can also save a bit of code here
    SortByColumns(
       Filter(
          '2nd Stage Reviews',
          Len(TextInput.Text) = 0 || field_3 = Value(TextInput.Text)
       ),
       "Created",
       SortOrder. Descending
    )
     
    Please click Does this answer your question 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 a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn   

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