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?
Solved! Go to Solution.
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?
Yes, that's basically what I was thinking.
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>)
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.
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"
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?
Yes, that's basically what I was thinking.
User | Count |
---|---|
174 | |
111 | |
86 | |
44 | |
42 |
User | Count |
---|---|
229 | |
118 | |
118 | |
74 | |
67 |