Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Search Using Multiple Filter Conditions

(0) ShareShare
ReportReport
Posted on by 6
I am currently working on a Canvas App. The Data Row Limit for the app is set to 50.
 
The screen has multiple fields that can be searched against. When the user clicks on Search button, the filter is applied, and resulting records are displayed in a gallery control.
 
 
In the OnVisible property, I have the following code:
UpdateContext(
    {
        locSearchResult: Blank()
    }
);
 
The OnSelect property of the Search button has the following code:
UpdateContext(
    {
        locSearchResult: Filter(
            MovieTitles,
            rxj_titletype in TypeCombobox.SelectedItems || CountRows(TypeCombobox.SelectedItems) = 0
        )
    }
)
 
The Items property of the gallery control is set to 
locSearchResult
The gallery control correctly displays records and it displays & stops at 50 records (since that is the data row limit).
 
If I move the filter code behind Search button to the Items property of the gallery control, it displays 100 records and continues loading when I scroll down.
 
Question
How can I manually trigger the search and still get the gallery to load the 100 records and load more when I scroll down? Any suggestions?
 
Categories:
  • Verified answer
    WarrenBelz Profile Picture
    146,601 Most Valuable Professional on at
    Search Using Multiple Filter Conditions
    Despite any collection workarounds that you may consider, the real question (which I asked before) is if the total number of records likely to be returned are going to exceed your Data Row Limit. If not, you can do this (a bit of a hack, but you will get all records not in batches immediately if they are under your DLR)
    With(
       {
          _Data:
          Filter(
             MovieTitles,
             rxj_titletype in TypeCombobox.SelectedItems || CountRows(TypeCombobox.SelectedItems) = 0
          )
       },
       _Data
    )
    You could also do a collection (which is limited to your DLR) and filter that, but if your returned data numbers are over your DLR, you will not get the full list.
    The conundrum I see is that you want the reverse of what is possible - if you have more records that your DLR, the only way to get them all is in a Delegable query (which will be in batches of 100). If you have less records, you can use what I posted (the With() statement is effectively a very temporary collection limited by the DLR).
  • Suggested answer
    Ravindra Jadhav Profile Picture
    263 Super User 2025 Season 1 on at
    Search Using Multiple Filter Conditions

    The issue arises because the Data Row Limit applies to local variables, while delegation allows more records when directly querying the data source. To solve this:

    • Implement pagination using FirstN and LastN functions.
    • Store the results in a collection instead of a variable.
    • Adjust the gallery’s Items property to load the next set of 50 records when triggered by user interaction (like a button click). This allows manual control of how many records are displayed at once.

    This method circumvents the 50-record limit and allows more efficient scrolling.

     

    t formula to implement pagination with the FirstN and LastN functions, and using a collection instead of UpdateContext:

    1. On the OnVisible property of the screen, initialize a collection:

    ClearCollect(colSearchResult, FirstN(MovieTitles, 50))
    1. On the OnSelect property of the Search button, update the collection with the next batch of 50 records:

    ClearCollect(
    colSearchResult,
    Filter(
    MovieTitles,
    rxj_titletype in TypeCombobox.SelectedItems || CountRows(TypeCombobox.SelectedItems) = 0
    )
    );
    Collect(
    colSearchResult,
    LastN(
    Filter(
    MovieTitles,
    rxj_titletype in TypeCombobox.SelectedItems || CountRows(TypeCombobox.SelectedItems) = 0
    ),
    50
    )
    )
    1. Set the Items property of the gallery to:

      colSearchResult
     
    Please Closed the Question, Mark it Solved 
     
    If my answer helped resolve your issue, please consider marking it as solved to assist others facing the same problem. Additionally, giving it a like would be greatly appreciated and motivates us to keep helping
     
    Thank You
    Ravindra Jadhav
    Please Subscribe to  https://www.youtube.com/@jadhav_ravi_oo7
    Connect On https://www.linkedin.com/in/ravindra-jadhav-powerplatform/
  • rajujoseph Profile Picture
    6 on at
    Search Using Multiple Filter Conditions
    I am using Dataverse. My requirement is, I always want users to click the Search button to apply the filter on the gallery control and still get the result in batches.
     
    If I use a collection and attach it to gallery, using ClearCollect if I apply the filter again, records are not returned in batches. 
     
    However, if I apply the filter on the gallery control, the results are batched.
     
    How can I trick so that filter is applied only when Search button is clicked and I still get the result in batches.
  • WarrenBelz Profile Picture
    146,601 Most Valuable Professional on at
    Search Using Multiple Filter Conditions
    The issue is that your Data Row Limit dictates the amount of records that can be stored "locally". In addition to non-Delegable queries, it also limits the content of Variables (such as your case), Collections and a number of other "client-side" functions such as GroupBy, AddColumns and With etc). 
    When however a query is Delegable (as in your case - I assume you are using Dataverse here) and is applied directly to a Table Control such as a Gallery or drop-down, your Data Row Limit is irrelevant as the query is Delegated to the data source and all required records are returned directly to the control. However for performance reasons, they are returned in batches of 100, which the user then needs to scroll down through. 
    So in answer to your question, you cannot change this if you want to return more records than your Data Row Limit.
     
    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    Buy me a coffee
  • abc 123 Profile Picture
    784 Super User 2025 Season 1 on at
    Search Using Multiple Filter Conditions
    If you need 100 items, then increase the Data Row Limit to 100.  
     
    Is the 100 you're getting now, so sort of duplication of data into the local variable? You might want to try using a collection instead.
     
    There's no events that can be triggered OnScroll.  However, with some ingenuity, maybe using the Gallery's OnSelect can help. You'll have to get creative and figure out when the user has clicked passed 50 records to get the "next" 50.

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,601 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,942 Most Valuable Professional

Leaderboard