cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Post Prodigy
Post Prodigy

DatePicker used in optional not as obligatory

Hello,

 

In my last topic (https://powerusers.microsoft.com/t5/Building-Power-Apps/Data-table-filter-modification/m-p/694197#M2...) I received a help in making my DatePicker works in my gallery.

This is the function:

 

Sort(Filter(Search(IdeaBox_1;SearchBox.Text;"Nazwa";"Opis"); 
Text(Utworzony;ShortDate) = Text(DatePicker1.SelectedDate;ShortDate)); 
Utworzony; If(SortDescending2;Descending;Ascending))

 

 

I use in my gallery SearchBox that i searching true filds Name/Description (Nazwa/Opis), and a button that lists all gallery records desc/asc of date.

 

I also added DatePicker1 that I wanted to use an additional source of possible filters.

This filter is however very problematic, because it is not optional - it filter the data in default mode.

 

So for example my gallery has 30 records - after implementing in Items of gallery updated function with listed DataPicker it only shows today records. When I delete value Today() it shows no records at all.

At this moment I have no means to show all RECORDS.

 

What I intented was to create a new filter that would help my users filter some data, but that would be optional not obligatory.

Is it possible to change this filter?

 

I thought that maybe I could use two DataPickers one would be start date of filter which would be set on 01.01.1900 and another would be Today() on default.

So it will list all records, but also allow users to search when they need.

 

Or maybe is there other way to achieve it? 

I found this function but I have troubles in implementing it in my formula:

I created DatePicker2

Filter(DataSourceName, EventDate > DatePicker1.SelectedDate && EventDate < DatePicker2.SelectedDate)

Thank you for your help.

10 REPLIES 10

@eka24 

I marked this as solution, but it is bugged and I believe it is PowerApps bug.

If I set DatePicker2 on Today() it will be one day off. So for example if there are records made on 22.09 it will show all records up to 21.09. I set DatePicker1 on as early as possible by default. Leaving it blank shows date 01-01-1970, but I tested many variations. DatePicker1 works OK, but DatePicker2 isn't.

 

I found this topic:

https://powerusers.microsoft.com/t5/Building-Power-Apps/Datepicker-returns-minus-1-day/td-p/3807/pag...

 

Hi, I encountered this too when my datepicker is set to UTC. OnVisible, it is set to 'TODAY', but it will always return the current date minus 1. So here is the workaround that I did, I set the default value of the datepicker to 'SelectedEventDate' and placed the code below on the OnVisible property of the screen:

 

UpdateContext({SelectedEventDate: DateValue(Text(Today(),DateTimeFormat.UTC))+1 })

 

I used this solution from that topic - but it works partially - it is by default setting a DatePicker2 on date that allows it to search well, but this date is one day ahead! So with this function Today() is 23.09.2020.

 

Using DatePickers like that is really confusing. My users will have to be aware that the filter is one day off.

Is there any workaround?

 

When I use your solution - when gallery open it is missing records when DatePicker2 is Today(). When I use this workaround DatePicker2 is one day ahead and it is very confusing but at least functional.

 

Please kindly advise if you have idea what to do.

 

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (75,248)