cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PowerAppsHori
Helper I
Helper I

Filtering Gallery by Date Won’t Work if Dates Match (i.e. Datepicker Date Matches Gallery Item’s Date)

I was watching this wonderful video by Reza Dorrani: 

https://youtu.be/5dSk5iOgT68

 

I am filtering a gallery that’s pulling information from a SharePoint list. The filter is filtering by modified date. So I have the following code in my Filter:

 

Modified >= FromDate.SelectedDate && Modifed <= ToDate.SelectedDate

 

It works great except for when dates match the Gallery date and it seems to be specific to the ToDate. For example, let’s say a listed item in the gallery was modified on July 10. If I selected July 10 in the FromDate datepicker, the listed items last modified on that date remain in the gallery. However, if I select July 10 in the ToDate datepicker, the items last modified on July 10 disappear from the Gallery. 

 

I would think the ‘equals to’ in the code would capture this date, but it doesn’t seem to. Am I doing something wrong? Can someone help? Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
iltoningui
Resolver I
Resolver I

Hi @PowerAppsHori,

 

I can't really be sure without more info, but i'm pretty sure that FromDate.SelectedDate and ToDate.SelectedDate are datetime values not date and most likely have midnight the time.

 

If that's the case you are comparing values between 2021-07-21 00:00:00 and 2021-07-21 00:00:00 which would return nothing.

 

 

DateTimeValue(Text(FromDate.SelectedDate, "[$-en-US]mm/dd/yyyy") & ",00:00:00");
DateTimeValue(Text(ToDate.SelectedDate, "[$-en-US]mm/dd/yyyy") & ",23:59:59")

 

 

This will ensure that the interval includes the entire day.

 

If this reply helped,

Consider marking it as a solution.

View solution in original post

3 REPLIES 3
gabibalaban
Super User
Super User

@PowerAppsHori ,

Use:

Modified >= FromDate.SelectedDate && Modifed <= DateAdd(ToDate.SelectedDate,1,Days)

I think that you will receive a delegation warning, but this can be solved with a context variable.

 

hope it helps !

iltoningui
Resolver I
Resolver I

Hi @PowerAppsHori,

 

I can't really be sure without more info, but i'm pretty sure that FromDate.SelectedDate and ToDate.SelectedDate are datetime values not date and most likely have midnight the time.

 

If that's the case you are comparing values between 2021-07-21 00:00:00 and 2021-07-21 00:00:00 which would return nothing.

 

 

DateTimeValue(Text(FromDate.SelectedDate, "[$-en-US]mm/dd/yyyy") & ",00:00:00");
DateTimeValue(Text(ToDate.SelectedDate, "[$-en-US]mm/dd/yyyy") & ",23:59:59")

 

 

This will ensure that the interval includes the entire day.

 

If this reply helped,

Consider marking it as a solution.

View solution in original post

This worked perfectly thank you!!

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (3,063)