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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Apps
Unanswered

IF & Switch Issue

(0) ShareShare
ReportReport
Posted on by 36

I have a gallery where I want to allow the user to either filter by status (dropdown) or do a search.

 

In my original code, I have an IF ISBLANK(searchbox), then use the switch to filter by status. When I use this code, I am limited to 2,000 rows when using the status dropdown (attachment 1 - Combined Code.png)

 

However, if I use only the switch code, I can scroll past 2,000 rows. It appears that when I include the IF statement, somehow that impacts the switch and delegation (attachment 2 - Switch_Code.png).

 

I am not sure why, when incorporating the IF statement, my switch code is limited to 2,000 rows. I understand that ISBLANK might not be delegable but that should not impact the switch code.

Combined_Code.png
Switch_Code.png
Categories:
I have the same question (0)
  • Rusk Profile Picture
    1,369 Super User 2024 Season 1 on at

    Hi @Robert_ 

     

    I recently read this excellent blog with a workaround to the 2000 limit.  I realize that wasn't your question but it could work for your use case: https://www.matthewdevaney.com/power-apps-search-a-sharepoint-list-no-delegation-warning/

     

    Regarding why the switch code is limited to 2k rows after using the If statement, I think that's intended.  Here's another article with another workaround!  https://www.matthewdevaney.com/create-power-apps-collections-over-2000-rows-with-these-4-tricks

  • WarrenBelz Profile Picture
    155,302 Most Valuable Professional on at

    Hi @Robert_ ,

    You have two fundamental non-delegable elements there - Search is simply not Delegable (so any query with it included is not Delegable) and also AddColumns is a Delegation Limitation on the record number output. The best you will do here is if this core query

    SortByColumns(
     Filter(
     Requests,
     Email = varUserEmail
     ),
     "ID",
     SortOrder.Descending
    )

    returns records less than your Delegation limit (or more specifically if the newest (limit) records contain the items you need, then this should work

    With(
     {
     wData:
     SortByColumns(
     Filter(
     Requests,
     Email = varUserEmail
     ),
     "ID",
     SortOrder.Descending
     )
     },
     Search(
     AddColumns(
     Filter(
     wData,
     StatusFilter.Selected.Value = "All Requests" ||
     ReqStatus = StatusFilter.Selected.Value
     ),
     "ReqID_Text",
     ReqID,
     "ExpenseType_Text",
     ExpenseType.Value,
     "Chartfieldl_Text",
     Chartfieldl,
     "ID2",
     Text(ID)
     ),
     SearchUserRequests.Text,
     "Merchant",
     "ReqID_Text",
     "ExpenseType_Text",
     "Chartfieldl_Descr",
     "Chartfieldl_Text",
     "ReqStatus",
     "ID2",
     "Justification"
     )
    )

    Also please remember to post your code in Text also - this was OCR'd so watch spelling.

     

    Please click Accept as solution 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 Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 1,045

#2
Valantis Profile Picture

Valantis 675

#3
11manish Profile Picture

11manish 592

Last 30 days Overall leaderboard