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

LRVinNC
Resident Rockstar
Resident Rockstar

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
Resident Rockstar
Resident Rockstar

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?
LRVinNC
Resident Rockstar
Resident Rockstar

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?

LRVinNC
Resident Rockstar
Resident Rockstar

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.

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,265)