cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper III
Helper III

Display gallery based on dropdown selected

I have a Sharepoint list and I have created galleries to filter the results of the Choice fields - Category Type, Current Status, Goal Status. 

 

The dropdown selections are working fine. However, I want users to only see the gallery based on their dropdown choice.

 

Category Type:   dropdown selection                 Only show Category Type Gallery results on page (hide others)

Current Status:   dropdown selection                 Only show Current Status gallery results on page (hide others)

Goal Status:       dropdown selection                  Only show Goal Status Gallery (hide other galleries)

 

Please see attached example of what the page look likes to visualize what I mean. 🙂

10 REPLIES 10
Highlighted
Super User III
Super User III

@ttaylor 

If I understand your problem correctly, there are 3 dropdown controls you are using to Filter a single gallery.  I think I can help here.  Put this code in the Items property of your gallery.

 

Filter(
    your_datasource_name,
    If(ddCategoryType.SelectedText = "-",
        CategoryType = CategoryType,
        CategoryType = ddCategoryType.SelectedText
    ),
    If(ddCurrentStatus.SelectedText = "-",
        CurrentStatus= CurrentStatus,
        CurrentStatus= ddCurrentStatus.SelectedText
    ),
    If(ddGoalStatus.SelectedText = "-",
        GoalStatus= GoalStatus,
        GoalStatus= ddGoalStatus.SelectedText
    )
)

Of course you will need to change the formula to match your control and field names.  Let me know if this works!

 

...

 

I want to explain my solution a little bit further.  My assumption is when the users selects this value no filter should be applied.

 

"-"

This code makes all the results appear because a field will always be equal to itself.

 

CategoryType = CategoryType

 

---
Please click "Accept as Solution" if my response helped to solve your issue so that others may find it more quickly. If your thought the post was helpful please give it a "Thumbs Up."

Highlighted
Super User
Super User

Use Combo boxes instead. You can turn off the "Allow Multiple" option, that will allow you to select none when needed. 

 

Here is an example that filters for my Customer Name, Division and Lead Source.

 

ComboBox Items:

Distinct(SPList.CustomerName, CustomerName)

Distinct(QuoteLog.Division,Division)

Distinct(QuoteLog.LeadSource,LeadSource)

 

Gallery Items:

If(!IsBlank(cb_Customer.Selected.Result),
 If(!IsBlank(cb_Division.Selected.Result),
  If(!IsBlank(cb_LeadSource.Selected.Result),
   Filter(QuoteLog, CustomerName=cb_Customer.Selected.Result && Division=cb_Division.Selected.Result && LeadSource=cb_LeadSource.Selected.Result),
   Filter(QuoteLog, CustomerName=cb_Customer.Selected.Result && Division=cb_Division.Selected.Result))
  ,
  If(!IsBlank(cb_LeadSource.Selected.Result),
   Filter(QuoteLog, CustomerName=cb_Customer.Selected.Result && LeadSource=cb_LeadSource.Selected.Result),
   Filter(QuoteLog, CustomerName=cb_Customer.Selected.Result))
 ),
 If(!IsBlank(cb_Division.Selected.Result),
  If(!IsBlank(cb_LeadSource.Selected.Result),
   Filter(QuoteLog, Division=cb_Division.Selected.Result && LeadSource=cb_LeadSource.Selected.Result),
   Filter(QuoteLog, Division=cb_Division.Selected.Result))
  ,
  If(!IsBlank(cb_LeadSource.Selected.Result),
   Filter(QuoteLog, LeadSource=cb_LeadSource.Selected.Result),
   QuoteLog))
 )

 

Three is about my limit on these or the If statement gets out of hand. Anymore than that and you should look at a collection and variables that adjust the collection. Hollar if you need anymore clarity. 

Highlighted

This is VERY helpful! I will certainly be using it.

 

I guess my original post should have said how can I change the visibility of a gallery based on the dropdorwn selected. 

Highlighted

For example, user selects a dropdown item from  "Category Type" and gallery results showing only Category Type appears on the right.

User selects a dropdown item from "Current Status" and the gallery results showing only Current Status appears on the right. I hope that makes sense. 

 

Highlighted

@ttaylor 

Maybe I am confused, lol?  Did either of our solutions work for you?  Initially I thought you had only 1 gallery, do you have 3 instead? Are you trying to Filter the gallery or make the entire gallery visible/hidden?

Highlighted

@mdevaney 

 

I understood there to be one gallery but three different filtering options with the ability to do any combination of those.

Highlighted

@rebeccas 

OK, it sounds like we had the same understanding.  Now I am just trying to decide if the thread is done or if @ttaylor requires additional help.

Highlighted

I actually have three galleries. 

1. Category Type (results are Organizations based on users choice from dropdown)

2. Current Status (again, results filter on Organization names based on dropdown choice)

3. Goal Status (again, results filter on Organization names based on dropdown choice)

 

T

Highlighted

@ttaylor 

 

Okay, that is not what I thought you meant. Sorry. 

 

To do that you can have three galleries sitting on top of each other that each filter off the dropdown or combo box selections. You can then set the visible property to show If the dropdown or combo box is not blank then show. 

 

BUT if you do this option you will have to make sure the other three clear out each time you select one. So you select a Company Name from that box the other two have to be forced to set back to blank or "-" so that only one gallery will show at a time or this won't work. 

 

Are each of the galleries different data sources? If not, I would suggest you consider just doing one gallery instead.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (9,709)