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
nate_halliwell
Advocate I
Advocate I

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
nate_halliwell
Advocate I
Advocate I

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

Gkrish23
Frequent Visitor

@nate_halliwell 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..!!

@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
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (18,715)