cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
EriSto
Helper II
Helper II

Filter by dropdown selection, or "all"

Hi all,

I

I have a gallery that will show orders from a SharePoint list depending on the column "Sent=false" and the selected "sending location" which is specified with a dropdown selection of pre-defined sending locations. 

Just as an example we have location A, B, C, etc. If the user selects "Location A", then the gallery will only show orders with "Location A" in the location column. 

This filter works just fine:


SortByColumns(Filter(Orders, Sent=false, Title=Dropdown2.SelectedText.Value), "Modified",Descending)

 

What would be the best way to add an " all locations" selection to the dropdown, and update the filter so that if "all locations" is selected, then every "sending location" available is displayed? 

I want the user to also be able to get a list of all locations with "Sent=False" instead of having to go through specific locations one by one, if need be. 

Thanks for any and all suggestions 🙂 

1 ACCEPTED SOLUTION

Accepted Solutions
v-qiaqi-msft
Community Support
Community Support

 

 

Hi @EriSto

Have you solved your problem?

Do you want to display all the locations with "Sent=False" by adding an " all locations" selection to the dropdown?

Could you please share a bit more about the scenario?

 

1). To display all the locations with "Sent=False", you could check the advice from @SqtaMorda that you could achieve this when there is nothing selected from your Dropdown2.

 

If(IsBlank(Dropdown2.SelectedText.Value),
   SortByColumns(Filter(Orders, Sent=false), "Modified",Descending),
   SortByColumns(Filter(Orders, Sent=false, Title=Dropdown2.SelectedText.Value), "Modified",Descending)
   )

 

However, you should make sure that you have set the "AllowEmptySelection" property of the Dropdown2 as True.

 

2). To add "AllLocations" to your Dropdown, you could consider create a collection to shape your Title by adding a "AllLocations" item. On your side, you should set the OnStart property of the App control to follownig:

 

ClearCollect(
             LocationCollection,
             {Title: "AllLocations"},
             Sort(Order_Locations, Title, Ascending) 
)

 

Then set the Items property of the Dropdown2 to follownig:

 

LocationCollection

 

Set the Items of the Gallery to following:

 

SortByColumns(
    If(
        Dropdown2.SelectedText.Value = "AllLocations",
        Filter(
            Orders,
            Sent=false
        ),
        Filter(
            Orders,
            Sent=false,
            Title = Dropdown2.SelectedText.Value
        )
    ),
    "Modified",
    Descending
)

 

Best Regards,
Qi

View solution in original post

4 REPLIES 4
eka24
Super User
Super User

Please take a screenshot of the formula on the Drop-down

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Hi, here are the items on the drop-down: 
Sort(Order_Locations, Title, Ascending) 

SqtaMorda
Resolver II
Resolver II

If(IsBlank(Dropdown2.SelectedText.Value ),

//if your selected location is blank then show all

SortByColumns(Filter(Orders, Sent=false), "Modified",Descending),

// else show filtered by selected location
SortByColumns(Filter(Orders, Sent=false, Title=Dropdown2.SelectedText.Value), "Modified",Descending))

v-qiaqi-msft
Community Support
Community Support

 

 

Hi @EriSto

Have you solved your problem?

Do you want to display all the locations with "Sent=False" by adding an " all locations" selection to the dropdown?

Could you please share a bit more about the scenario?

 

1). To display all the locations with "Sent=False", you could check the advice from @SqtaMorda that you could achieve this when there is nothing selected from your Dropdown2.

 

If(IsBlank(Dropdown2.SelectedText.Value),
   SortByColumns(Filter(Orders, Sent=false), "Modified",Descending),
   SortByColumns(Filter(Orders, Sent=false, Title=Dropdown2.SelectedText.Value), "Modified",Descending)
   )

 

However, you should make sure that you have set the "AllowEmptySelection" property of the Dropdown2 as True.

 

2). To add "AllLocations" to your Dropdown, you could consider create a collection to shape your Title by adding a "AllLocations" item. On your side, you should set the OnStart property of the App control to follownig:

 

ClearCollect(
             LocationCollection,
             {Title: "AllLocations"},
             Sort(Order_Locations, Title, Ascending) 
)

 

Then set the Items property of the Dropdown2 to follownig:

 

LocationCollection

 

Set the Items of the Gallery to following:

 

SortByColumns(
    If(
        Dropdown2.SelectedText.Value = "AllLocations",
        Filter(
            Orders,
            Sent=false
        ),
        Filter(
            Orders,
            Sent=false,
            Title = Dropdown2.SelectedText.Value
        )
    ),
    "Modified",
    Descending
)

 

Best Regards,
Qi

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (1,655)