cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jbrit2020
Continued Contributor
Continued Contributor

Filter gallery to show only results created today

Hi all,

 

I'm kind of struggling with filtering a gallery by date.

 

I'm using a SQL database where the dates are stored in datetime2(7) format.

 

I need to look at displaying only today's dates on the gallery, and for that the only way I found is by doing:

Filter('OP.ORMSRMUpdates', Meeting= SelectedMeeting.Subject,IsToday(Dateupdate))

It works, but it throws a delegation warning.

 

How can I do this in a different way so that I get rid of the delegation warning?

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
eka24
Super User
Super User

To eliminate the delegation warning on sql, I sugest you create another column for the Date as per documentation:

"Direct date filters do not work for SQL Server. However, you can create a calculated column that will work. For instance, ALTER TABLE myTable ADD DateAsInt AS (YEAR([date]) * 10000 + MONTH([date]) * 100 + DAY([date])) and then filter on the calculated number column."

 

Then use the calculated column for all filtering with sql dates

Documentation:

SQL Server - Connectors | Microsoft Docs

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

 

View solution in original post

5 REPLIES 5
eka24
Super User
Super User

Can you clarify what SelectedMeeting.Subject is referring to. Is it a Datepicker or a Column Name. Also DateUpdate

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

jbrit2020
Continued Contributor
Continued Contributor

SelectedMeeting.Subject is a variable selection from another gallery and DateUpdate is the date of each record in the gallery I want to filter

Ramole
Super User
Super User

Hi @jbrit2020 

Try this 

 

Filter( 'OP.ORMSRMUpdates', 'Date due' = Today() )    

 

No delegation warning

Thank you
If this post helps, then Click on the Thumbs Up below. and Accept it as the solution . to help others find helpful.
eka24
Super User
Super User

To eliminate the delegation warning on sql, I sugest you create another column for the Date as per documentation:

"Direct date filters do not work for SQL Server. However, you can create a calculated column that will work. For instance, ALTER TABLE myTable ADD DateAsInt AS (YEAR([date]) * 10000 + MONTH([date]) * 100 + DAY([date])) and then filter on the calculated number column."

 

Then use the calculated column for all filtering with sql dates

Documentation:

SQL Server - Connectors | Microsoft Docs

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

 

jbrit2020
Continued Contributor
Continued Contributor

Thanks for the help, doesn't work unfortunately as the SQL field returns date and time and will therefore never match Today(). I will try @eka24 approach

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (1,552)