cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
nithishguptak
Helper II
Helper II

using a variable in another screen

Hello all,

 

So I'm trying to filter my gallery based on a text box. It works if the text box is in same screen. attached are the screenshots, please let me know where am i going wrong. How can I make a value global ? 

 

one.PNGtwo.PNG

1 ACCEPTED SOLUTION

Accepted Solutions
HarshJaswal
Frequent Visitor

The scope of UpdateContext  is limited to the screen in which it is used. 

 

Try using Set(). This is used to declare the global variables which you can use throughout the App session.

Set(StatusValue,"TheValueWhichYouWantToset")

View solution in original post

7 REPLIES 7
akandis
Responsive Resident
Responsive Resident

Hello @nithishguptak 

 

You are using UpdateContext() that only works in the context of the screen where created, and is a good practices because this help in the performance of the Power Apps. But when you want to have a global variable you have to use Set(), this can be used in any place of the app.

 

Set(StatusValue; "")

 

HarshJaswal
Frequent Visitor

The scope of UpdateContext  is limited to the screen in which it is used. 

 

Try using Set(). This is used to declare the global variables which you can use throughout the App session.

Set(StatusValue,"TheValueWhichYouWantToset")
timl
Super User
Super User

To add to the excellent and correct answers that @HarshJaswal and @akandis have given, I also notice that you're chaining the UpdateContext and Navigate functions with the & operator rather than ;;. If you were to use Set, the syntax would look like this:

Set(StatusValue; "Sofortmaßnahme definiert");;Navigate(JournalScreen_view;None)

Just for reference, if you want to use context variables and to pass a value from one screen to another, you can do this by calling Navigate like so:

 

Navigate(JournalScreen_view;None;{StatusValue:"Sofortmaßnahme definiert"})

 

Drrickryp
Super User
Super User

@nithishguptak 

One more thing, a  variable can be either context or global but not both. 

nithishguptak
Helper II
Helper II

@Drrickryp @timl @HarshJaswal @akandis Thanks for saving my time. It worked

HarshJaswal
Frequent Visitor

Glad that I could help. 🙂

nithishguptak
Helper II
Helper II

@HarshJaswal @Drrickryp @timl how do I use toggle to show all the data from the sharepoint in combination with above filter ?

 

So If i set toggle to true it should show all the fields. also by default all the fields 

Helpful resources

Announcements
October Events

Mark Your Calendars

So many events that are happening this month - don't miss out!

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.

Users online (2,569)