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

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / Delegatio on functions...
Power Pages
Unanswered

Delegatio on functions with switch

(0) ShareShare
ReportReport
Posted on by 4
Hi I am creating an app that is used across multiple countries. The app uses Sharepoint as data source but the set of lists changes with the user region. Up to this moment I used something a bite brute-forcish like this (just as an example):
 
Count(Filter(Switch(varRegion, "Region1", List1, "Region2", List2, "Region3", List3, "Region4", List4), field1 =  var1 &&  field2 = var2).ID)
 
What I noticed is that the Switch function with such an approach breaks down delegation on SP, so it works fine with lists with just over 1000 lines, and breaks down on list with over 4k lines. The functions work fine if I split them to not use Switch or If after Filter - however with that the code grows quite significantly with no apparent need. Any way to do it better? Can I somehow store datasource as variable within the tool (it's not environmental so env variable will not work I think)
 
 
Categories:
I have the same question (0)
  • SaiRT14 Profile Picture
    1,990 Super User 2025 Season 2 on at
    Delegatio on functions with switch
    Try the following:
    Store List in a Variable:: Set(varDataSource, Switch(varRegion, "Region1", List1, "Region2", List2, ...))
    Count(Filter(varDataSource, field1 = var1 && field2 = var2).ID)
     
  • JL-14111105-0 Profile Picture
    4 on at
    Delegatio on functions with switch
    Storing list in var has smilar issues - it breaks delegatio and in only able to pick up data from 1st 2000 rows

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 Pages

#1
Jerry-IN Profile Picture

Jerry-IN 66

#2
Fubar Profile Picture

Fubar 45 Super User 2025 Season 2

#3
Michael E. Gernaey Profile Picture

Michael E. Gernaey 31 Super User 2025 Season 2

Last 30 days Overall leaderboard