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 Platform Community / Forums / Power Apps / Making a gallery filte...
Power Apps
Unanswered

Making a gallery filter delegable

(0) ShareShare
ReportReport
Posted on by 1,257 Super User 2024 Season 1

This is the Items code for my gallery and it works fine, however I am worried my data source might creep up beyond 2k . Is there anyway I can change the syntax below to not get delegation warnings. The warnings seem to be on the And and the In

 

Filter(MyDataSource,Status="Complete" And MyPerson.DisplayName in Label4.Text And (Text(Date, DateTimeFormat.ShortDate) = Text(Today(), DateTimeFormat.ShortDate)|| Text(DateAdd(Today(), -1, Days),DateTimeFormat.ShortDate) = Text(Date, DateTimeFormat.ShortDate)))

 TIA

Categories:
I have the same question (0)
  • BCBuizer Profile Picture
    22,833 Super User 2026 Season 1 on at

    Hi @vffdd ,

     

    What data source are you using? 

     

    Can you please try:

     

    With(
    	{
    	tDay: Text(
    		Today(),
    		DateTimeFormat.ShortDate
    	),
    	yDay: Text(
    		DateAdd(
    			Today(),
    			-1,
    			Days
    		),DateTimeFormat.ShortDate
    	)
    	},
    	Filter(
    		MyDataSource,
    			Status="Complete",
    			StartsWith(MyPerson.DisplayName, Label4.Text), 
    			Text(Date, DateTimeFormat.ShortDate) = tDay || 
    			Text(Date, DateTimeFormat.ShortDate) = yDay
    	)
    )

     

    Here I have replaced the in operator with a StartsWith function which is usually delegable, but has slightly limited functionality since it only looks at the start of a string.

  • vffdd Profile Picture
    1,257 Super User 2024 Season 1 on at

    Thanks @BCBuizer unfortunately startswith is no good to me as the label contains a concatenated list of names selected from a combo box so the name could be in the middle !.  Is there a way to maybe not use that text label and just use the names selected from the multi-select combo box?  but then again that would be  a similar "in" scenario? 

  • BCBuizer Profile Picture
    22,833 Super User 2026 Season 1 on at

    Hi @vffdd ,

     

    Indeed an in operator is needed for that as well.

     

    What you can do is to pre-filter your items using a delegable filter and then apply the non-delegable filter to that:

     

    Filter(
    	With(
    		{
    		tDay: Text(
    			Today(),
    			DateTimeFormat.ShortDate
    		),
    		yDay: Text(
    			DateAdd(
    				Today(),
    				-1,
    				Days
    			),DateTimeFormat.ShortDate
    		)
    		},
    		Filter(
    			MyDataSource,
    				Status="Complete",
    				Text(Date, DateTimeFormat.ShortDate) = tDay || 
    				Text(Date, DateTimeFormat.ShortDate) = yDay
    		)
    	),
    	MyPerson.DisplayName in Label4.Text
    )	

     

    This will still give a delegation warning, but assuming you'll not have more than 2000 items that have a Complete status and a date for the current and next day, that will not be relevant.

     

    To be very sure, you can test if this works by lowering the Data Row Limit to something like 20 and then see what the behaviour is.

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @vffdd 

    If you will definitely not have more than 4k records, you can use this formula from @WarrenBelz 's blog Practical PowerApps.  It will work with any number of records where the delegation limit is set to 2k.  After 4k records, it will not get all the records in in the list into the collection.

     

     

    Clear(colMyCollection);
    With(
     {
     wDesc: 
     Filter(
     Sort(
     MyList,
     ID,
     Descending
     ),
     Status = "Planned"
     ),
     wAsc: 
     Filter(
     Sort(
     MyList,
     ID
     ),
     Status = "Planned"
     )
     },
     Collect(
     colMyCollection,
     wAsc,
     Filter(
     wDesc,
     !(ID in wAsc.ID)
     )
     )
    )

     

     

     

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 477

#2
WarrenBelz Profile Picture

WarrenBelz 341 Most Valuable Professional

#3
11manish Profile Picture

11manish 317

Last 30 days Overall leaderboard