cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sajarac
Kudo Kingpin
Kudo Kingpin

Filter Gallery using a Dropdown

Good morning,

Sunday question!! I am so sorry is Sunday and too early.

I have a typical gallery:

SortByColumns(Filter([@Tbl_Orders], StartsWith(Title, TextSearchBox1.Text)), "Title", If(SortDescending1, Descending, Descending))

 

And I have a Dropdown

Distinct(Tbl_Ordders,ContractYear)

 

How Can I sort my gallery based in the drop down value selected?

 

Thanks in advance,

2 ACCEPTED SOLUTIONS

Accepted Solutions
WarrenBelz
Super User III
Super User III

Good Evening @sajarac  (late Sunday night here),

Replace with your drop-down control name

SortByColumns(
   Filter(
      [@Tbl_Orders], 
      StartsWith(
         Title, 
         TextSearchBox1.Text
      ) &&
      ContractYear = YourDropDownName.Selected.Result
   ), 
   "Title", 
   If(
      SortDescending1, 
      Ascending, 
      Descending
   )
)

Also you have a typo at the bottom with the sort (were both descending)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

@sajarac 
Dates cannot be delegated in SharePoint.  Sad but true.  As a workaround, you must also store the dates as a Number type which can be delegated and FILTER using them instead.

 

The video by @RezaDorrani does a better job of explaining it than I could ever do on the forums
https://www.youtube.com/watch?v=eCMuXPI1Qok

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

4 REPLIES 4
WarrenBelz
Super User III
Super User III

Good Evening @sajarac  (late Sunday night here),

Replace with your drop-down control name

SortByColumns(
   Filter(
      [@Tbl_Orders], 
      StartsWith(
         Title, 
         TextSearchBox1.Text
      ) &&
      ContractYear = YourDropDownName.Selected.Result
   ), 
   "Title", 
   If(
      SortDescending1, 
      Ascending, 
      Descending
   )
)

Also you have a typo at the bottom with the sort (were both descending)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

mdevaney
Super User III
Super User III

@sajarac 

What dropdown value do you want to base your Sort on?


It sounds like you want to FILTER based on contract year, not SORT.


SortByColumns(Filter([@Tbl_Orders], StartsWith(Title, TextSearchBox1.Text), ContractYear=Dropdown_ContractYear.Selected.Result), "Title", If(SortDescending1, Descending, Ascending))

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

 

Thank you,

It works, just one minor thing.

 

I am getting a Delegation warning.

"the highlighted part of this formula might not work correctly with column"ContractYear" on large date sets.

 

Will this cause an issue in the future?

@sajarac 
Dates cannot be delegated in SharePoint.  Sad but true.  As a workaround, you must also store the dates as a Number type which can be delegated and FILTER using them instead.

 

The video by @RezaDorrani does a better job of explaining it than I could ever do on the forums
https://www.youtube.com/watch?v=eCMuXPI1Qok

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (62,996)