cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
RichBoud
Level: Powered On

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
Level: Powered On

Re: Return a value from a generic screen to multiple calling screens

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

Super User
Super User

Re: Return a value from a generic screen to multiple calling screens

Yes, that's basically what I was thinking.

View solution in original post

6 REPLIES 6
Super User
Super User

Re: Return a value from a generic screen to multiple calling screens

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

RichBoud
Level: Powered On

Re: Return a value from a generic screen to multiple calling screens

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?
Super User
Super User

Re: Return a value from a generic screen to multiple calling screens

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.

 

MrNappa
Level: Powered On

Re: Return a value from a generic screen to multiple calling screens

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
Level: Powered On

Re: Return a value from a generic screen to multiple calling screens

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

Super User
Super User

Re: Return a value from a generic screen to multiple calling screens

Yes, that's basically what I was thinking.

View solution in original post

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,444)