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
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (2,905)