cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
omi18
Post Partisan
Post Partisan

Filter Gallery Based on Button And / Or Toggle

Hello,

 

As shown below I have a gallery getting filtered by combo box and search field. What I'm trying to do is once we get results based on combo box selection. The user should be able to filter the gallery based on toggle tool selection. 

 

Screen Shot 2021-04-02 at 3.29.20 PM.png

 

Any Suggestions?

 

Thanks,

Omi

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @omi18 ,

Are you sure this is a numeric field (1 or 0)?  I suspect a Boolean (yes/no) as you have referred to Processed as one. Assuming the toggle is linked to Processed, then the Default of the toggle should be

Parent.Default

I am not sure where you are heading with the code you posted.

If you simply want to filter by Processed based on the Toggle value (whether it is linked to anything or not)

Sort(
   Search(
      Filter(
         'Database',
         Processed=YourToggleName.Value
      ),
      InsSearchBar_2.Text,
      "Name",
      "Team",
      "Fullname"
   ),
   LastName,
   Ascending
)

 

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

5 REPLIES 5
zmorek
Community Champion
Community Champion

Here's a nice short video on how to filter a gallery by multiple criteria:

https://www.youtube.com/watch?v=kLGglidmPxg

 

It should help! You might need to buttons to set a variable in order to have the gallery filter based on its value, but that should be about it.

WarrenBelz
Super User
Super User

@omi18 ,

You did not provide any code or field/control names, but this should be the syntax required

Search(
   Filter(
      YourListName,
      (
         IsBlank(YourComboBox.Selected.xxxx) || 
         YourFieldName=YourComboBox.Selected.xxxx
      ) &&
      YourYesNoFieldName.Value = YourToggleName.Value
   ),
   YourTextSeachBoxName,
   "YourFieldToSearchOn"
)

also xxxx will depend on the Items of your Combo Box.

 

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.

omi18
Post Partisan
Post Partisan

Hi @WarrenBelz ,

 

Thanks for your reply.

 

For Toggle1 I have a default property set to: Distinct(Filter('Database',ID=First(ComboBox.SelectedItems).ID),Processed) but getting an error "Boolean value expected"

And in the Database, I have 1 for True and 0 for False.

 

And For Gallery I Have: Sort(Search(Filter('Database',ID=ComboBox.Selected.ID,Hrs>0),InsSearchBar_2.Text,"Name","Team","Fullname"),LastName,Ascending)

 

And for the flag in the gallery Color set to: If(ThisItem.processed=true,RGBA(54, 176, 75, 1),RGBA(255, 191, 0, 1))

 

What I'm trying to achieve is once the user gets the result in the gallery then the gallery can be filtered based on the toggle. 

 

Let me know if you need more information.

 

Best,

Omi

Hi @omi18 ,

Are you sure this is a numeric field (1 or 0)?  I suspect a Boolean (yes/no) as you have referred to Processed as one. Assuming the toggle is linked to Processed, then the Default of the toggle should be

Parent.Default

I am not sure where you are heading with the code you posted.

If you simply want to filter by Processed based on the Toggle value (whether it is linked to anything or not)

Sort(
   Search(
      Filter(
         'Database',
         Processed=YourToggleName.Value
      ),
      InsSearchBar_2.Text,
      "Name",
      "Team",
      "Fullname"
   ),
   LastName,
   Ascending
)

 

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.

 

omi18
Post Partisan
Post Partisan

Hi @WarrenBelz ,

 

it worked. 

 

Thanks,

Omi

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,032)