cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jeguizabal
Level: Powered On

Show all items in a gallery if dropdown is blank

Hi,

 

I have a dropdown with information of a sharepoint list, de column of information is "Choice", so I conect the data to de dropdown with this formula:

Choices('Visitas para ventas'.'Canal Comercial')

 

So I have a gallery and a graphic that I need to see the information if I chose any option of the dropdown, I conect that with this formula:

Gallery

If(Dropdown1.Selected.Value = None ;'Visitas para ventas';SortByColumns(Filter('Visitas para ventas';'Canal Comercial'.Value = Dropdown1.Selected.Value);"{FilenameWithExtension}";Ascending))

Graphic

AddColumns(Filter('Visitas para ventas';'Canal Comercial'.Value = Dropdown1.Selected.Value);"Canal C";('Visitas realizadas'/'Visitas programadas'))

 

The problem is that I want to see all the records in the gallery and graphic if i don´t select nothing in the dropdown, Is there any code that I can use to do this.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Show all items in a gallery if dropdown is blank

Hi @jeguizabal ,

 

I just tested with the same scenario. If your Choice column does not include a null value, then the default selected value will never be blank for this dropdown control. So all the above formulas won't work.

 

If you want to start with a blank item in the dropdown, you can set its Items property to a collection where the first element is blank. Set below formula in the OnStart property of your app:

 

ClearCollect(C1,{Value:""});;Collect(C1,Choices('Visitas para ventas'.'Canal Comercial'))

Then set below formula in the Items property of your dropdown control.

 

 

C1.Value

For Items property of your Gallery, set to:

If(IsBlank(Dropdown1.Selected.Value);'Visitas para ventas';SortByColumns(Filter('Visitas para ventas';'Canal Comercial'.Value = Dropdown1.Selected.Value);"{FilenameWithExtension}";Ascending)))

This works for me. Please go ahead and have a try.

 

 

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
Edwin-Abdalian
Level 10

Re: Show all items in a gallery if dropdown is blank

Have you considered using the isBlank() function. 

Items = If (isBlank(Dropdown1.Selected.Value), 'Visitas para ventas', "ELSE apply the filter")

Super User
Super User

Re: Show all items in a gallery if dropdown is blank

Have you try using IsBlank()?

 

 

If(IsBlank(Dropdown1.Selected.Value) ;'Visitas para ventas';SortByColumns(Filter('Visitas para ventas';'Canal Comercial'.Value = Dropdown1.Selected.Value);"{FilenameWithExtension}";Ascending))

 

 



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.
Community Support Team
Community Support Team

Re: Show all items in a gallery if dropdown is blank

Hi @jeguizabal ,

 

I just tested with the same scenario. If your Choice column does not include a null value, then the default selected value will never be blank for this dropdown control. So all the above formulas won't work.

 

If you want to start with a blank item in the dropdown, you can set its Items property to a collection where the first element is blank. Set below formula in the OnStart property of your app:

 

ClearCollect(C1,{Value:""});;Collect(C1,Choices('Visitas para ventas'.'Canal Comercial'))

Then set below formula in the Items property of your dropdown control.

 

 

C1.Value

For Items property of your Gallery, set to:

If(IsBlank(Dropdown1.Selected.Value);'Visitas para ventas';SortByColumns(Filter('Visitas para ventas';'Canal Comercial'.Value = Dropdown1.Selected.Value);"{FilenameWithExtension}";Ascending)))

This works for me. Please go ahead and have a try.

 

 

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Edwin-Abdalian
Level 10

Re: Show all items in a gallery if dropdown is blank

yes Mona, I remember that in one of my projects, I added a "-" to my choices and handled it that way. If we want to use the isBlank() function then we need to follow your suggestion and use a collection.

 

Edwin

Highlighted
Dual Super User
Dual Super User

Re: Show all items in a gallery if dropdown is blank

Hey @jeguizabal 

 

By default, dropdown control selects its first item. You can have a combobox control in case you do not want to have a default value selected. You can set the "Allow Multiple Selections" toggle to off.
 
Can you try to update your expressions as:
Gallery
If(CountRows(Combobox1.SelectedItems) = 0 ;'Visitas para ventas';SortByColumns(Filter('Visitas para ventas';'Canal Comercial'.Value = Combobox1.Selected.Value);"{FilenameWithExtension}";Ascending))

Graphic
AddColumns(Filter('Visitas para ventas';'Canal Comercial'.Value = Combobox1.Selected.Value);"Canal C";(Value('Visitas realizadas')/Value('Visitas programadas')))
 
Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 91 members 4,892 guests
Please welcome our newest community members: