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

Can't filter gallery by variable

Hi there! - I am trying to filter a gallery by a variable that has been passed over to the screen where the gallery sits. 

DemandFamily is the variable and does have a value when trying to filter.

Navigate('Filter Down Screen', ScreenTransition.UnCoverRight, {DemandFamily: ThisItem.'Family Name'} < This is how the variable gets its value

Filter(
  SKUs,
    'Demand Family'.'Family Name' = 'Demand Family Dropdown_2'.Selected.Result

) << Works

Filter(
  SKUs,
    'Demand Family'.'Family Name' = DemandFamily
) << Brakes the gallery

Any ideas?

13 REPLIES 13
eka24
Super User III
Super User III

What formula are you using for the variable.

Try:

 

Filter(
  SKUs, DemandFamily in
    'Demand Family'.'Family Name'

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

bennking
Frequent Visitor

I have added the formula on how the variable is populated with a value.

 

DemandFamily in 'Demand Family'.'Family Name' produces the same result and just brakes the gallery (there are no syntax errors). 

I assume the variable is inside a Gallery. If so change it to

Navigate('Filter Down Screen', ScreenTransition.UnCoverRight);

Set(DemandFamily, ThisItem.'Family Name')

 

Filter:

Filter(SKUs, DemandFamily in 'Demand Family'.'Family Name')

Or

Filter(SKUs,'Demand Family'.'Family Name' = DemandFamily)

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

eka24
Super User III
Super User III

Please is this issue resolved

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

How does it break your gallery?  What is happening?  

 

Also have you put a label on your screen and populated it with the variable to make sure the value is what you think it is?



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.
BennDev
Frequent Visitor

Both of these don't work! So weird 😕

By brake, I mean no results appear in the gallery.

'Demand Family'.'Family Name' = 'Demand Family Dropdown_2'.Selected.Result  << This works, but when I change the filter to ue the variable that has the excact same value as 'Demand Family Dropdown_2'.Selected.Result it doesen't work 😞 

Do you get any syntax errors or red squiggly lines?    If so what is the error message?

 

Did you verify the content of the variable by displaying it as a label?   Whenever I run into an issue like this I always verify the variable by using it in a label.   Many times there is something with the value of the variable that shows up when displayed in a label.



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.

No syntax errors or squiggly lines! I have written lots of code in this Power App but this bug has stumped me. 

Making the variable a label does indeed show the value as expected. Weird 😞 

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

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

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (43,371)