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

Default filter on gallery

I have a gallery with different work items. I have already created a dropdown list that is connected to my gallery (the dropdown has different status of the current work items). I also want to filter on the specific tagg \Business Tracks\Make by default. so when I am at the page it shows only work items with the tagg Make and then I can filter by status (by choosing the right status in the dropdown list).

 

Gallery2.jpgGallerydropdown1.jpgDropdown listlabel 2.jpgLabelAccount name.jpgexcel

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Default filter on gallery

Hi @Djanan ,

If you use Dropdown control in your app, and set the Items property to Distinct(Tickets, Status), the Dropdown box would be populated with a default value (the first value from the Distinct(Tickets, Status) formula). If you use ComboBox in your app, the ComboBox would not auto-fill a default value.

 

Do you also want to filter your Gallery Items based on the Account Name value chosen manually (from a Dropdown box)? If you also want to filter your Gallery Items based on the Account Name value chosen manually, you could consider add another Dropdown box (Dropdown2) in your app, set the Items property to following:

Distinct(Tickets, AccountName)

Set the Default property of the Dropdown box to following:

"\Business Tracks\Make"

 

Then modify your Filter formula as below:

Filter(
         Tickets,
         Status = Dropdown1.Selected.Result,
AccountName = Dropdown2.Selected.Result )

 

Please take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
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

15 REPLIES 15
Dual Super User
Dual Super User

Re: Default filter on gallery

How is the default filter set?  Is it always the same?  If it is then you simply need to add it to the Search() or Filter() formula being used for the Items property of the gallery.  I usually do this by adding it as either a variable or a hidden label on the screen. Then set that value and use that in your Search/Filter string.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Djanan
Level: Powered On

Re: Default filter on gallery

I have now changed the default to following: Filter(Tickets, isFolder=true && "\Business Tracks\Make" in AccountName)

 

But it is not working. 

default filter.jpg

Dual Super User
Dual Super User

Re: Default filter on gallery

What data source is the content coming from?  And what is the AccountName field?  Shouldn't you be tesing against Path or something similar?



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Djanan
Level: Powered On

Re: Default filter on gallery

It is coming from an Excel file published on onedrive. 

Account name.jpg

Dual Super User
Dual Super User

Re: Default filter on gallery

Try '=' or StartsWith() instead of 'in'.  You are trying to check a field value where in checks to see if the value is in the column, not the specific record.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Djanan
Level: Powered On

Re: Default filter on gallery

Still error, I have tried with both method '=' and 'StartsWith()'

startswith.jpg

Community Support Team
Community Support Team

Re: Default filter on gallery

Hi @Djanan ,

Based on the formula you provided, I think there is something wrong with it. The Default property of the Gallery control is required to provide a record value, but the Filter formula you provided returns a Table value.

 

As an alternative solution, please consider take a try with the following workaround:

Set the OnVisible property of the Make screen to following:

ClearCollect(
                     InitialCollection, 
                     Filter(Tickets, isFolder = true, "\Business Tracks\Make" in AccountName)
)

Set the Items property of the Gallery to following:

If(
    !IsEmpty(InitialCollection),
     InitialCollection,
     Filter(Tickets, Status = Dropdown1.Selected.Result)
)

Set the OnSelect property and OnChange property of the Dropdown1 to following:

Clear(InitialCollection)

Please consider take a try with above solution, then navigate to another screen, and then navigate back to the Make screen (fire the OnVisible property of the Make screen), check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Djanan
Level: Powered On

Re: Default filter on gallery

Hi @v-xida-msft 

 

Thank you for your help but it didn't work. 

new solution.jpg

Community Support Team
Community Support Team

Re: Default filter on gallery

Hi @Djanan ,

Based on the screenshot that you provided, it seems that there is something issue with the isFolder column. Please check if there is a column called isFolder in your Tickets Excel table.

 

If there is no column called isFolder in your Tickets Excel table, please remove the isFolder = true condition from your Filter formula.

 

Note: Within your Filter function, the filtered column you referenced must be existed in your Tickets Excel table. You could not reference columns from another data source within the Filter function.

 

Best regards,

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

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 (Last 30 Days)
Users online (6,193)