cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
VladosBlaboski
New Member

Change Gallery filter parameters by Variable and Collection

Hi,

I'm new to PowerApps and need to be able to change the parameter of the filter(Gallery) by pressing a button that changes the collection in a ComboBox.

I have so far created the buttons which changes the var "varFilter": First button changes it to colUnit - (a collection of choices() from a multiple choice collumn called 'Business Unit1') - the second button changes 'varFilter' to colServiceT  - (a collection of choices() from a choice collumn) - I use Set(varFilter;colXXX) in the OnSelect of the buttons.

In Items of the gallery I use this code to filter:

 

Filter(
Services_1;
(ID in Ungroup(
ForAll(
ComboBox3_2.SelectedItems;
Filter(
Services_1;
If(varFilter=colUnit; Value in 'Business Unit1'.Value;varFilter=colServiceT; Value in 'Service Type'.Value
))
);
"Value"
).ID || IsBlank(ComboBox3_2.SelectedItems.Value)))

 

The Highligted code is where it gives me delegation error, but the list is not gonna be bigger than 400 rows so I dont think that will matter. I think I need help with how to reference to the value in varFilter in the if() statement, but tbh not too sure why it does not work. 🙃

English is not my first language so please ask if there is something I have to explain better. 😁

4 REPLIES 4
StalinPonnusamy
Super User
Super User

Hi @VladosBlaboski 

 

You may need to change a code a bit different. And "In" is not delegable but it will be fine since your total count less than the limit.

Filter(Services_1;
IsBlank(ComboBox3_2.SelectedItems.Value) ||
(ID in Ungroup(
ForAll(ComboBox3_2.SelectedItems;
Filter(Services_1;
If(varFilter=colUnit; Value in 'Business Unit1'.Value;varFilter=colServiceT; Value in 'Service Type'.Value
))
);
"Value"
).ID ))

 

Please provide more information to assist more.

  • What is your Data source?
  • What is the Items property of Combo box


Thanks,
Stalin - Learn To Illuminate 

Hi @StalinPonnusamy 

1. The data source is a Sharepoint list.

2. The Items property of the ComboBox is simply varFilter (which works when clicking the buttons)

 

 

Hi @VladosBlaboski 

 

We need to set variables to know which button clicked along with the Varfilter. So set the Business Unit button 1 OnSelect property to

Set(varFilter;colUnit);; Set(varFilterUnit; true)

 

Set Service Type button Onselect property to

Set(varFilter;colService);; Set(varFilterUnit; false)

 

Items property of the gallery to

Filter(Services_1;
IsBlank(ComboBox3_2.SelectedItems.Value) ||
(ID in Ungroup(
ForAll(ComboBox3_2.SelectedItems;
Filter(Services_1;
If(varFilterUnit; Value in 'Business Unit1'.Value;Value in 'Service Type'.Value
))
);
"Value"
).ID ))

 

If this does not work then please the collection sample. So that I can reproduce and provide the answer.

 


Thanks,
Stalin - Learn To Illuminate

Hi @VladosBlaboski 


Please let us know if anything needs on your post. We can help with this.

Please mark the post as Solved If I have answered your question.
Please give it a Thumbs Up if you find the suggestion helpful

Thanks,
Stalin - Learn To Illuminate

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 (4,266)