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

Return a value from a generic screen to multiple calling screens

I am trying to produce a generic screen within my app that does a specific calculation based on user input (in this case a keypad with a decimal point). That form could be used by various different screens from within the app. I can get PowerApps to pass a value to the generic screen along with the sending screen object. I can then do stuff and return to the original screen by navigating back to the sending object. However, I cannot work out how to pass the new data back to the original screen. I suppose I would somehow pass the context variable from the original screen to the generic screen and update that, but I cannot work out how to do this.

 

Any ideas?

2 ACCEPTED SOLUTIONS

Accepted Solutions
RichBoud
Frequent Visitor

I have a number of screens that take decimal values. Since there is no decimal point on the numeric entry keypad, I thought I would produce my own.

 

The process is something like:

Screen loads and the numeric control pulls data from the sharepoint list.

The user taps on the control to change it.

A keyboard pops up and allows the user to type in a decimal value.

That decimal value is put back in to the control to update the database.

The keyboard closes.

 

It is sounding like two global variables is needed, one containing a decimal and the other containing the name of the calling screen. The original screen then responds differently depending on which screen call it.

 

Is this the best way?

View solution in original post

Yes, that's basically what I was thinking.

LRVinNC

------------------
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.

View solution in original post

6 REPLIES 6
LRVinNC
Super User
Super User

Use a global variable, not a context variable.  Global variables are available throughout your app.  Context variables are only available within a single screen.  For this reason, I use EXCLUSIVELY global variables in my applications.  

 

To set a global variable use:  Set(gblVarName, <value to be set>)

LRVinNC

------------------
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.
RichBoud
Frequent Visitor

I would need a different global variable for each caller. I’d then need to tell the called screen which global variable to use. I can’t work out how. Is there a way?

Not sure I understand why you believe  you would need a different global variable for each calling screen.  Is the type of data you need to pass back different based on which screen called it?  You could do this, if necessary, by setting a global variable with an indicator as to which screen you came from and then having a switch in the generic screen that does something different based on which screen it came from and setting a different global variable in each switch alternative.  The calling screen would then process whichever global variable pertained to that screen.  

If you can provide a little more detail about what you are trying to accomplish, we might be able to offer more assistance.

 

LRVinNC

------------------
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.
MrNappa
Kudo Collector
Kudo Collector

I just want to point out that you can also set context variable(s) when navigating.

 

For example, Navigate( Screen2, ScreenTransition.Cover, { foo: "bar" } );

 

This will make a local variable 'foo' available in Screen2 with the value set to "bar"

RichBoud
Frequent Visitor

I have a number of screens that take decimal values. Since there is no decimal point on the numeric entry keypad, I thought I would produce my own.

 

The process is something like:

Screen loads and the numeric control pulls data from the sharepoint list.

The user taps on the control to change it.

A keyboard pops up and allows the user to type in a decimal value.

That decimal value is put back in to the control to update the database.

The keyboard closes.

 

It is sounding like two global variables is needed, one containing a decimal and the other containing the name of the calling screen. The original screen then responds differently depending on which screen call it.

 

Is this the best way?

View solution in original post

Yes, that's basically what I was thinking.

LRVinNC

------------------
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.

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Microsoft Ignite 768x460.png

Find your focus

Explore the latest tools,training sessions,technical expertise, networking and more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

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

Users online (2,367)