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

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 I
Helper I

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

HarshJaswal
Frequent Visitor

Glad that I could help. 🙂

nithishguptak
Helper I
Helper I

@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
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Top Solution Authors
Users online (3,222)