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.

1 ACCEPTED SOLUTION

Accepted Solutions

Use this:

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

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

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

10 REPLIES 10
Super User III
Super User III

Using Datapicker1 and 2, Use the formula;

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

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

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.

@eka24 

 

Ok. it showed 25 errors, but when I added ) at the end it showed only 4 errors:

All Invalid type of argument expected number and received text.

 

Elitezone_0-1600675064081.png

 

Yes because of the comparison, there should a value:

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

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

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.

@eka24 

This is weird. I used this function:

 

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

 

It now shows all results, all filters but date works well.

 

No matter what value I provide in DataPickers the filter does not change.
It always shows all records (f.e if I make both data pickers on 20.09.2020 it should show one proposition) but it shows all):

Elitezone_0-1600676507887.png

 

 

Show a screenshot of your Column from your Datasource. Do you get errors in the formula? 

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

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.

@eka24 

There are no errors at all.

Just 3 warning (delegation) from a different source.

 

I use date of creation in gallery:

Elitezone_0-1600678215918.png

 

This is from Sharepoint list:

Elitezone_1-1600678265634.png

Data type: Date and hours

Date format: Standard/Friendly (are the last settings).

 

This is a standard field (same as modified by).

@eka24 

Do you perhaps have any idea what to do 😞

I would be very grateful as those filters are very important and I cannot fix them myself.

Let me send you a private message

Use this:

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

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

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

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 (61,089)