cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
kingy61422
Helper III
Helper III

Filter gallery using dropdown

I am filtering my gallery by multiple dropdowns and it works until I add a dropdown for the date. Each dropdown will populate all the selections from the SP list, ExpenseMaster, each dropdown has its own collection for the item for EX: UnitDropdown items is BLUFUnit. The screen OnVisible will

ClearCollect(BLUFUnit, { Result: "All" } )

Collect(BLUFUnit, Distinct(ExpenseMaster, Unit) )

The gallery has If statements to filter EX: UnitDropdown.Selected.Result <> "All", Filter(ExpenseMaster, Unit = UnitDropdown.Selected.Result)

 

When I do the same process for the date dropdown the screen OnVisible says there are invalid arguments for both ClearCollect and Collect. The DateDropdown will not show any options and my gallery says these types can't be compared: Error, Text. This is the code for the error DateDropdown.Selected.Result = "All".

Can I do this for a date if not how would I be able to filter my gallery based on the selected date

1 ACCEPTED SOLUTION

Accepted Solutions
iAm_ManCat
Super User
Super User

the types are incompatible - I would assume your 'Date of Operation' is a date field, and you are trying to mix a text value of "All" to values defined as a date.

 

There's a few ways to approach this - first, you could add a toggle above/next to the datepicker, and have your formula reference that ie ShowAllDatesToggle.Value, and then have your dropdown's displaymode depend on whether that is toggled.

Your other option is to change the first value to Blank() which it won't assume has a type and so should allow you to change your formula to DateDropdown.Selected.Result = Blank()

 

I could probably come up with a few other ways to work around this problem but these two were the first that come to mind and I think both could work.

 

Cheers,

Sancho

@iAm_ManCat


Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


View solution in original post

3 REPLIES 3
iAm_ManCat
Super User
Super User

the types are incompatible - I would assume your 'Date of Operation' is a date field, and you are trying to mix a text value of "All" to values defined as a date.

 

There's a few ways to approach this - first, you could add a toggle above/next to the datepicker, and have your formula reference that ie ShowAllDatesToggle.Value, and then have your dropdown's displaymode depend on whether that is toggled.

Your other option is to change the first value to Blank() which it won't assume has a type and so should allow you to change your formula to DateDropdown.Selected.Result = Blank()

 

I could probably come up with a few other ways to work around this problem but these two were the first that come to mind and I think both could work.

 

Cheers,

Sancho

@iAm_ManCat


Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


Everything worked thank you.

Is there a way to have All be a option in the dropdown?

Yes, 'kind of' is my best answer for this - if you created a new single line of text column, 'DateOfOperationText' and then whenever you patch/store the date you also patch/store the text version of it - that way you will have a text column that you can filter by and it will be able to be collected into a collection with other text values

@iAm_ManCat


Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


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.

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 (2,472)