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

How to filter gallery with one datepicker and multiple filter or search criteria.

Hello Everyone,

 

I'm new to Powerapps and the community and hope that this is the correct channel.

 

I have done some filtration but the filtration is with "StartsWith" but i would love to have it as a "contain...".

 

Also i would like to add the Date-picker to work as for now it has no function but i would like to filter the time-cards depending on date, the date picker name is DateSearch

 

Please check the attachment and the filtration I'm using at the moment.

 

Filter('Check-in',StartsWith('Reporting user?'.Email,TextSearch.Text))

 

Thanks in advance!

//Gabbey

6 REPLIES 6
mdevaney
Super User
Super User

@Gabbey 

Is your "ReportingUser?" column a Person/Group type?  If so, I believe you can achieve your goal with the help of a ComboBox and the FILTER function.  First, create a new ComboBox with the following properties.  Make sure to change the code to your sharepoint list name.

 

Items: [@your_sharepoint_list_name].'Reporting user?'
DisplayFields: ["Email"]
SearchFields: ["DisplayName","Email"]
IsSearchable: true

 

Then put this code in the Items property of your Gallery.

 

Filter(your_sharepoint_list_name,'Reporting user?' in ComboBox1.SelectedItems)

 

Now the ComboBox will take care of partial matches for you!

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Hello @mdevaney ,

 

Thank you for the fast reply!

But it doesn't work well, it still complains, I've done as you said below.

 

 

In gallery Items i added:
Filter('My_SP_List','Reporting user?' in ComboBox.SelectedItems)

 

 

 

My combobox is called: ComboBox and I added these as you said:
[@My_SP_List].'Reporting user?'
In DisplayFields i added: ["Email"]
In SearchFields i added: ["DisplayName","Email"]
In IsSearchable i added: true

 

 

But still get an Issue that complains, see attachment.

 

Also i would prefer to have one datepicker seperately where i can choose the date and also be able to filter on the filter field seperatly to combine both values for who it is and what date...

 

Thanks for the fast reply! 😃

@Gabbey 

It appears I wrote a function that was non-delegable.  Here's what I suggest you put in the Items property of your Gallery instead.  I made sure to test the code.  Try this code and let me know if the warning disappears.

 

Filter('My_SP_List','Reporting user?'.Email = ComboBox.Selected.Email)

 

@mdevaney 

Thank you for the fast reply, I just saw that my IsSearchable in ComboBox get false automatically even if i change it to true, do you know why and can you help me with that? as this doesn't clearly want to work for me 😞

 

Also the filter is a invalid argument type

@Gabbey 

I am not sure what is going on here. I made a demo app on my side to replicate your situation but I am just not having the same issues...

 

When it comes to IsSearchable reverting back to false: that's just weird and I'm not sure what to do about it.

 

The invalid argument type means the criteria being compared the FILTER statement have different data types.  I am just guessing at your field names/data structure so you might have to play around with it for a bit.  The error usually does say what data type was passed and what data type was expected.  You should start there when trying to resolve it.

 

Sorry that this is not going so smoothly.  Troubleshooting over the forums without having access to the app can be tough sometimes.

@mdevaney Ain't sure ether why this occurs.

 

But I would like to go with the original post where i want to be able to filter with a TextInput + DatePicker.

Do you have any idea on how to make this for the gallery "Items" as a filter and selected date work?

Created this:

Filter('Check-in',StartsWith('Reporting user?'.Email,TextSearch.Text) Or StartsWith('Reporting user?'.DisplayName,TextSearch.Text) Or Text('Date of check-in?') = Text(DateSearch.SelectedDate,ShortDate))

 

But it complains, probably because of max 500 entries and then it will be bad end result.

 

This works:

Filter('Check-in',StartsWith('Reporting user?'.Email,TextSearch.Text) Or StartsWith('Reporting user?'.DisplayName,TextSearch.Text))

And this works:

Filter('Check-in',Text('Date of check-in?') = Text(DateSearch.SelectedDate,ShortDate))

 

but it doesn't work well together, as the date gets a blue line and i get a warning sign that it says that 

Br,

Gabbey

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (5,365)