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

Problem with UpdateContext and Set ?

Hi All,

 

Please help i just started to using Power Apps, I'm trying to set a variable default value on Screen OnVisible and access show it on Screen through label, I have used both UpdateContext and Set method to do it. but i don't see the default variable in the label's Text value. 

 

It only appear after action performed on the variable, on button click event and assign different value to the variable using UpdateContext but how can i access the default value ?

 

What i'm doing wrong here ?

 

Thanks

 

1 ACCEPTED SOLUTION

Accepted Solutions
Pstork1
Dual Super User III
Dual Super User III

UpdateContext and Set create two different kinds of variables.  You can't use them with the same variable name.  But to do what you describe try this.

1) in the OnVisible property of the screen enter the following function.

Set(myVar, "Test Label")

2) add a label to that screen and set the Text property to the following

myVar

Start your app on a different screen and navigate to the screen where you put the label.  You should see the text.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

4 REPLIES 4
Pstork1
Dual Super User III
Dual Super User III

UpdateContext and Set create two different kinds of variables.  You can't use them with the same variable name.  But to do what you describe try this.

1) in the OnVisible property of the screen enter the following function.

Set(myVar, "Test Label")

2) add a label to that screen and set the Text property to the following

myVar

Start your app on a different screen and navigate to the screen where you put the label.  You should see the text.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

C-Papa
Super User
Super User

hi, it might be best to post your code see we can see what is happening, but the below should work:

Screen OnVisible: Set(var_test_msg,"Hello World")

Label1 Text: var_test_msg

 

You can't use Set and UpdateContext with the same variable name, it's one or the other

Thanks @Pstork1  . 

Thanks @C-Papa . 

Helpful resources

Announcements
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (1,689)