web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Show all items in a ga...
Power Apps
Answered

Show all items in a gallery if dropdown is blank

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

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.

Categories:
I have the same question (0)
  • Edwin-Abdalian Profile Picture
    641 on at

    Have you considered using the isBlank() function. 

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

  • Jeff_Thorpe Profile Picture
    6,085 Super User 2024 Season 1 on at

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

     

     

  • Verified answer
    v-monli-msft Profile Picture
    Microsoft Employee on at

    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

  • Edwin-Abdalian Profile Picture
    641 on at

    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 Profile Picture
    24,769 Super User 2024 Season 1 on at

    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!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 326 Most Valuable Professional

#2
11manish Profile Picture

11manish 168

#3
sannavajjala87 Profile Picture

sannavajjala87 75 Super User 2026 Season 1

Last 30 days Overall leaderboard