cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Gkrish23
Frequent Visitor

Filter gallery using Date Picker & Text box in Power-Apps

Hi,

     I have been working on an app that I need to filter the gallery by using text box (search) and date picker (Start-date & End-date). 

 

Date-Picker:

Gkrish23_0-1612353114244.png

text-box:

Gkrish23_1-1612353171957.png

   Gallery Name: Feedback Info  - where it contains info such as Area,Created by, Floor Name, Location, Created (date) etc stored in share-point.

  

  Based on the text box values I want to filter the gallery at first, if in-case I want to narrow down further then need to use date range functionality. 

 

For ex:  Suppose If I type my name in text box then I will get all the info related to my name in gallery. If I want to check the specific time-period/date between November 2020 to December 2020 using date picker function, this is where I am not getting the exact result.

 

Code details are as follows for search text-box : (attached) and Date picker: (attached)

 

Please help assist on this query.

 

Thanks.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

try this:

 

If(IsBlank(DatePicker_Start.SelectedDate),If(IsBlank(DatePicker_Start.SelectedDate),If(IsBlank(Searchbox.Text),FeedbackInfo,Filter(FeedbackInfo,Or(Searchbox.Text in Area, Searchbox.Text in Floor, Searchbox.Text in 'Created By'.DisplayName))),Filter(If(IsBlank(Searchbox.Text),FeedbackInfo,Filter(FeedbackInfo,Or(Searchbox.Text in Area, Searchbox.Text in Floor, Searchbox.Text in 'Created By'.DisplayName))),DaveValue(CreatedDate) >= DatePicker_Start.SelectedDate)),Filter(If(IsBlank(DatePicker_Start.SelectedDate),If(IsBlank(Searchbox.Text),FeedbackInfo,Filter(FeedbackInfo,Or(Searchbox.Text in Area, Searchbox.Text in Floor, Searchbox.Text in 'Created By'.DisplayName))),Filter(If(IsBlank(Searchbox.Text),FeedbackInfo,Filter(FeedbackInfo,Or(Searchbox.Text in Area, Searchbox.Text in Floor, Searchbox.Text in 'Created By'.DisplayName))),DaveValue(CreatedDate) >= DatePicker_Start.SelectedDate)),DaveValue(CreatedDate) <= DatePicker_End.SelectedDate))

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

try this:

 

If(IsBlank(DatePicker_Start.SelectedDate),If(IsBlank(DatePicker_Start.SelectedDate),If(IsBlank(Searchbox.Text),FeedbackInfo,Filter(FeedbackInfo,Or(Searchbox.Text in Area, Searchbox.Text in Floor, Searchbox.Text in 'Created By'.DisplayName))),Filter(If(IsBlank(Searchbox.Text),FeedbackInfo,Filter(FeedbackInfo,Or(Searchbox.Text in Area, Searchbox.Text in Floor, Searchbox.Text in 'Created By'.DisplayName))),DaveValue(CreatedDate) >= DatePicker_Start.SelectedDate)),Filter(If(IsBlank(DatePicker_Start.SelectedDate),If(IsBlank(Searchbox.Text),FeedbackInfo,Filter(FeedbackInfo,Or(Searchbox.Text in Area, Searchbox.Text in Floor, Searchbox.Text in 'Created By'.DisplayName))),Filter(If(IsBlank(Searchbox.Text),FeedbackInfo,Filter(FeedbackInfo,Or(Searchbox.Text in Area, Searchbox.Text in Floor, Searchbox.Text in 'Created By'.DisplayName))),DaveValue(CreatedDate) >= DatePicker_Start.SelectedDate)),DaveValue(CreatedDate) <= DatePicker_End.SelectedDate))

Gkrish23
Frequent Visitor

@Anonymous Thanks for the quick response. I am getting the expected results. 

What if I want to add a drop-down box along with both Date-picker and search box?

 

Drop-down box (Items) contain country locations such as India,Thailand etc. Based on the country wise I want to filter the same gallery along with both functions. In that case , what adjustments do we need to make in the code?

 

Please assist on this..!!

Anonymous
Not applicable

@Gkrish23 i recently made a video about this exact scenario, actually....  https://www.youtube.com/watch?v=0bRR-Zq407c

 

essentially you'll need to nest the entire formula from my original post inside of an If(isBlank(CountryDropDown.Selected.Value), ......) formula.

Gkrish23
Frequent Visitor

@nate_halliwell Thanks for the update. Now I have understood the logic behind the filter function.!!

 

Kudos to the video as well..!!

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (4,021)