cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
Frequent Visitor

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

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

Highlighted
Frequent Visitor

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

 

Highlighted
Advocate IV
Advocate IV

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"

Highlighted
Frequent Visitor

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

Highlighted
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
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,258)