cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate II
Advocate II

Drop Down List - used to filter entity - need a null/all value

I have a CDS Entity "Agency," of which the "State" field is a Lookup Field from an Entity "State." The "Agency" Entity populates a gallery which is then filtered in my app by a drop down list populated from the "State" Entity, like so:

 

Filter('Agency',State.Name = DropDown.SelectedText.Name)

 

I have created a blank record in that "State" Entity. My trouble is that when I set the default value of the drop down list to a null value, or "", or "-" or -, the filter fails to populate the gallery at all.

Is there a value I can use in the drop down list which will nullify my gallery filter, and allow the gallery to be populated by all its records?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User II
Super User II

Re: Drop Down List - used to filter entity - need a null/all value

One way you can do is to use a combo box instead of a dropdown. Set the MultiSelect property of the combo box to false. Set the Items property of the combo box to the same as that of the dropdown that you have now.

The default property of the combo box actually allows you to not select any value (unlike dropdown).

You can then change the Items property of the gallery to:

Filter('Agency', IsBlank(ComboBox.Selected) || State.Name = ComboBox.Selected.Name)

Let me know if this helps. It can also be achieved with a dropdown if you really want to use one but I dont like the idea of a blank value.

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.

Thanks!
Hardit Bhatia
The Power Addict
https://thepoweraddict.com

View solution in original post

4 REPLIES 4
Highlighted
Super User III
Super User III

Re: Drop Down List - used to filter entity - need a null/all value

If your entity populate the dropdown, then Make sure the first row does not contain any text. That's remove the first name in the column that populate the dropdown.
After that ,
Filter('Agency',State = DropDown.Selected.Value)
Highlighted
Super User II
Super User II

Re: Drop Down List - used to filter entity - need a null/all value

One way you can do is to use a combo box instead of a dropdown. Set the MultiSelect property of the combo box to false. Set the Items property of the combo box to the same as that of the dropdown that you have now.

The default property of the combo box actually allows you to not select any value (unlike dropdown).

You can then change the Items property of the gallery to:

Filter('Agency', IsBlank(ComboBox.Selected) || State.Name = ComboBox.Selected.Name)

Let me know if this helps. It can also be achieved with a dropdown if you really want to use one but I dont like the idea of a blank value.

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.

Thanks!
Hardit Bhatia
The Power Addict
https://thepoweraddict.com

View solution in original post

Highlighted
Super User II
Super User II

Re: Drop Down List - used to filter entity - need a null/all value

Also, if the default value of your dropdown is the blank value that you have created, then you could modify the gallery items property to something like this:

Filter('Agency', DropDown.Selected.Name = "" || State.Name = DropDown.Selected.Name)

Suggest using Dropdown.Selected.Name rather than SelectedText.

Anyways, let me know of any of these work for you and if not, what error messages you get.

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.

Thanks!
Hardit Bhatia
The Power Addict
https://thepoweraddict.com
Highlighted
Super User II
Super User II

Re: Drop Down List - used to filter entity - need a null/all value

Glad I could help! Good luck with the rest of the app! Feel free to reach out in case of any questions!

Thanks!
Hardit Bhatia
https://thepoweraddict.com

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (8,744)