cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Aread62127
Regular Visitor

Please Help! - Variables not being picked up when starting or previewing an App

Hi All, hope you can help

 

As practice i wanted to build a simple App. Im struggling with the second page recognising the variable which is set from the home screen. Ill explain below:

 

Home Screen - Allows you to select a name using a button (Alex, Paul, Jane). on Select sets a 'Person' variable to the name that's pressed.

 

Browse Screen - I have made a gallery which filters based on which person has been selected. This actually worked when i first wrote the code OR edit the code. But if i open the Power App again or run it, the Filters do not seem to work and it just shows all results. The code is below:

 

Filter(If(Person = "Alex", Filter([@Table1], ('Whos Bill' = Person)), If(Person = "Paul", Filter(Table1, ('Whos Bill' = Person)), If(Person = "Jane", Filter(Table1, ('Whos Bill' = Person)), If(Person = "Jono", Filter(Table1, ('Whos Bill' = Person)), Table1)))), (TextSearchBox1.Text in Supplier) && (TextSearchBox1.Text in 'Outgoing/Bills'))

 

Hope you can help!

 

 

 

 

11 REPLIES 11
WarrenBelz
Super User
Super User

Hi @Aread62127 ,

I think you just need this

Filter(
   Table1,
   (IsBlank(Person) || 'Whos Bill' = Person) &&
   (
      Len(TextSearchBox1.Text) = 0 || 
      (TextSearchBox1.Text in Supplier || TextSearchBox1.Text in 'Outgoing/Bills')
   )
)

 

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.

Visit my blog Practical Power Apps

 

@WarrenBelz Thanks for the shortened version it works great when i am editing and testing but when i save and publish then run the app, for some reason the Gallery is blank. Its like its not filtering or not recognising data or filter variable?

So when i Edit the app again, it doesnt refresh the variable through to the code on the page. I have to press on the code and then off again for it to change to the variable name. Do you know why?

@Aread62127 ,

I cannot duplicate that here - I tested the same syntax on a test list and it worked fine (as it should as it is quite a basic filter). How and when are you setting the Variable?

@WarrenBelz 

I have a home screen where the user would choose their name via a button. This then Sets the Person variable to that name. When im on the gallery page, it doesnt recognise the Variable straight away until I press on and off the code. Its like its not refreshing the Variable on this page.

@WarrenBelz Its probably worth mentioning, from the Home screen is navigates to a password screen first. Then when this is typed in correctly, goes to the gallery screen which doesnt show any data as the variable doesnt show.

@Aread62127 ,

Is the variable being set ? Put a Label on the screen with Person as the Text and see if it shows the value you need.

Hi @Aread62127 ,

Just checking if you got the result you were looking for on this thread. Happy to help further if not.

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.

Visit my blog Practical Power Apps

Hi Warren, sorry if i wasnt clear to start but the issue was because the variable wouldnt transfer over more than two screens. I had to re-set the variable on the first screen to then recognise it in the second/third etc. Is there another way to make a 'Global' variable that carries accross onto every screen without calling it again?

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Top Kudoed Authors
Users online (1,474)