cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Gallery Filtered by combobox don't retrieve data on start

Hello,

 

I want to display a Gallery where must filtered the items based on items selected on a comobox plus a dropdown. The dropdown is quite simple. I have set up the items of the gallery to display to:

"If(IsBlank(StageSearch.Selected),Candidates,Filter(Candidates, Stage.Value = StageSearch.Selected.Result))"

 

In other words I am displaying the Candidates table if no value was selected on the StageSearch and filtering the data if any is selected.

 

The problem is to display the values from the combobox which could have multiple options selected. The way I was using was based on the solution on this topic: https://powerusers.microsoft.com/t5/Building-PowerApps-Formerly/Filtering-gallery-by-multiple-select...

 

In this configuration it is used I adjusted table and all the items included in the Gallery are grouped and the trick is done on its visibility which was set to: "If(IsEmpty(SkillSearch.SelectedItems),true,"yes" in Concat(ForAll(SkillSearch.SelectedItems.Value, If(Value in ThisItem.Skills.Value, "yes","no")),Value))"

 

My problem now is that the gallery does not display any value until I select any value on the combobox (named SkillSearch). However, if I select one arbitrary skill and then unselect it the solution works just fine. Do you have any idea why this happens?

 

To unselect the values from the combobox should be the same effect as the function of reset the combobox, however with this method it has different outputs and I still haven't figured out why...

 

Thanks in advance!

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Gallery Filtered by combobox don't retrieve data on start

Hi @PedroPereira ,

Do you put your Filter formula within the Items property of the Gallery control?

 

If you want to put your Filter formula within the Items property of the Gallery control, you could not use the ThisItem operator within the Items property.

I have made a test on my side, please consider modify your formula as below:

Set the Items property of the Gallery to following:

Filter(
        Candidates,
If(IsBlank(StageSearch.Selected.Result), true, Stage.Value = StageSearch.Selected.Result),
If(
IsBlank(SkillSearch.Selected.Value),
true,
"yes" in Concat(ForAll(SkillSearch.SelectedItems, If(Value in Skills.Value, "yes", "no")), Value)
) )

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

 

If you want to reference the column values from the Candidates data source within your Gallery, you could use the following formula:

ThisItem.ColumnName

More details about the ThisItem operator in PowerApps, please check the following article:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/operators#thisitem-operator

 

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

4 REPLIES 4
Highlighted
Community Support
Community Support

Re: Gallery Filtered by combobox don't retrieve data on start

Hi @PedroPereira ,

Could you please share a bit more about your scenario?

Do you want to filter your Gallery Items based on the Dropdown value and ComboBox value?

 

Based on the If condition that you mentioned, I think there is something wrong with it. I have made a test on my side, please consider take a try with the following workaround:

Set the Items property of the Gallery to following:

Filter(
        Candidates,
If(IsBlank(StageSearch.Selected.Result), true, Stage.Value = StageSearch.Selected.Result),
If(
IsBlank(SkillSearch.Selected.Value),
true,
Concat(ForAll(SkillSearch.SelectedItems.Value, If(Value in ThisItem.Skills.Value, "yes","no")),Value)
) )

In addition, if you want to check if a specific value existed within the ComboBox selected values, please use the following formula:

If("Specific Value" in ComboBox1.SelectedItems.Value, "Yes", "No")

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.
Highlighted
Frequent Visitor

Re: Gallery Filtered by combobox don't retrieve data on start

Hello,

 

Thank you for your prompt answer.

 

Yes, I want to filter my Gallery with the dropdown (one value) and the combox (multiple values).

 

I have a gallery with a set of candidates where I want to resctrict the candidates shown based on the dropdown value and the combox values selected. To accomplish that I have set the Items from the Gallery to display all values if no option was selected on the drowpdown:

If(IsBlank(StageSearch.Selected),Candidates,Filter(Candidates, Stage.Value = StageSearch.Selected.Result))

The Gallery was a adjusted vertical and then I group all the items of each item in a group and change their visibility to display all values if no values was selected in the combox and to display only the candidates who have at least one skill selected on the combox (named SearchSkill):

If(IsEmpty(SkillSearch.SelectedItems),true,"yes" in Concat(ForAll(SkillSearch.SelectedItems.Value, If(Value in ThisItem.Skills.Value, "yes","no")),Value))

The only problem is that the Gallery only starts to displays values if I choose one value (if I unselect all values from the combobox all the candidates are shown - which should be the behavior when from the beginning).

 

 

If I try to edit the item property of the Gallery to proposed:

Filter(
        Candidates,
        If(IsBlank(StageSearch.Selected.Result), true, Stage.Value = StageSearch.Selected.Result),
        If(
            IsBlank(SkillSearch.Selected.Value), 
            true, 
            Concat(ForAll(SkillSearch.SelectedItems.Value, If(Value in ThisItem.Skills.Value, "yes","no")),Value)
        )
)

 

There is a error on the function "ThisItem". I guess it is because, here we are giving the information to the Gallery information source and therefore I can not use the function ThisItem.

 

If not clear enough, please tell me.

Thank you again.

Highlighted
Community Support
Community Support

Re: Gallery Filtered by combobox don't retrieve data on start

Hi @PedroPereira ,

Do you put your Filter formula within the Items property of the Gallery control?

 

If you want to put your Filter formula within the Items property of the Gallery control, you could not use the ThisItem operator within the Items property.

I have made a test on my side, please consider modify your formula as below:

Set the Items property of the Gallery to following:

Filter(
        Candidates,
If(IsBlank(StageSearch.Selected.Result), true, Stage.Value = StageSearch.Selected.Result),
If(
IsBlank(SkillSearch.Selected.Value),
true,
"yes" in Concat(ForAll(SkillSearch.SelectedItems, If(Value in Skills.Value, "yes", "no")), Value)
) )

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

 

If you want to reference the column values from the Candidates data source within your Gallery, you could use the following formula:

ThisItem.ColumnName

More details about the ThisItem operator in PowerApps, please check the following article:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/operators#thisitem-operator

 

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

Highlighted
Frequent Visitor

Re: Gallery Filtered by combobox don't retrieve data on start

Hello @v-xida-msft , thank you for your help. Your solution has solved my problem! However, now I have an issue with delagation which I didn't have before. Do you have any suggestion to overcome it?

 

"Do you put your Filter formula within the Items property of the Gallery control?" Yes, I did.

 

Best regards,

Pedro Pereira

Helpful resources

Announcements
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Users online (3,462)