So I'm trying to filter a gallery and I have drop down date selector which uses a collection to create the Start and End dates.
I can filter for Yesterday, This Week, Last Week, This Month fine but it just won't show any Today records. Yes I do have records in their to display.
So I create a collection On Start to create the time filters:
In my Gallery I'm filtering like this:
So here is the view of the gallery with nothing selected:
And when I selected Today:
But when I select like This Week:
Solved! Go to Solution.
The issue here is that your filter is trying to compare DATE ONLY values (from your OnStart collection) with DATE TIME values in your gallery. A simple fix is to wrap your TimeIn and TimeOut gallery values is a formula that returns a date only, something like this:
// for TimeIn
DateValue(Text(TimeIn,DateTimeFormat.ShortDate)) ...
// for TimeOut
DateValue(Text(TimeOut,DateTimeFormat.ShortDate)) ...
The reason for this is that when you set Today() in your OnStart collection it also set the time as 12:00AM, hence when you try to compare a gallery value to your "Today" dropdown selection it's looking for any date_time values from:
StartDate: 25/10/2021 12:00AM to
EndDate: 25/10/2021 12:00AM ... so the same time of day, if that makes sense?
The issue here is that your filter is trying to compare DATE ONLY values (from your OnStart collection) with DATE TIME values in your gallery. A simple fix is to wrap your TimeIn and TimeOut gallery values is a formula that returns a date only, something like this:
// for TimeIn
DateValue(Text(TimeIn,DateTimeFormat.ShortDate)) ...
// for TimeOut
DateValue(Text(TimeOut,DateTimeFormat.ShortDate)) ...
The reason for this is that when you set Today() in your OnStart collection it also set the time as 12:00AM, hence when you try to compare a gallery value to your "Today" dropdown selection it's looking for any date_time values from:
StartDate: 25/10/2021 12:00AM to
EndDate: 25/10/2021 12:00AM ... so the same time of day, if that makes sense?
I thought as much when I was setting the hard codes for Today(), but yeah I have added that code you mentioned into my Items filter so it is comparing the dates rather than the times also.
Thank you very much I have learnt something new on my journey in powerapps!
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.
User | Count |
---|---|
199 | |
72 | |
51 | |
42 | |
30 |
User | Count |
---|---|
266 | |
121 | |
94 | |
90 | |
81 |