cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

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
v-monli-msft
Community Support
Community Support

Hi @Anonymous ,

 

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
Impactful Individual
Impactful Individual

Have you considered using the isBlank() function. 

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

Jeff_Thorpe
Super User
Super User

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.
v-monli-msft
Community Support
Community Support

Hi @Anonymous ,

 

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.

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

yashag2255
Dual Super User II
Dual Super User II

Hey @Anonymous 

 

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
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.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (3,500)