Hello! I'm currently writing an application and have encountered an inconsistency in how PowerApps handles local variables when passed using the Navigate() command. When navigating to a screen whose name is specified using a context variable from the previous screen, the records are not created properly. It's a bit difficult to explain, so let me use an example:
Example:
An app has three screens, "One", "Two", and "Three". On each screen, there is a button containing the below-listed OnSelect code.
Screen One: Navigate(Two, None, {forward: Three, back: One})
Navigate to screen two using no transition, passing the records "forward" and "back".
Result on button press: PowerApps navigates correctly to screen Two. Variables "forward" and "back" are set up properly.
Screen Two: Navigate(forward, None, {forward: Blank(), back: back})
Navigate to the screen specified in the variable "forward" (Three) using no transition, passing the records "forward" and "back".
Result on button press: PowerApps navigates correctly to screen Three. Variables "forward" and "back" are NOT set up properly on the next screen and cannot be read.
Screen Three: Navigate(back, None)
Navigate to the previous screen using no transition.
Result on button press: PowerApps fails to navigate, as the "back" variable was not set up properly on the previous screen.
Further experimentation leads me to believe this problem is exclusive to Navigate() calls where the page destination is a variable name specified in a context record; navigating to pages defined with an on-page UpdateContext() call function as intended.
If you're wondering what my use case for this weird page navigation structure is, I have a screen whose functionality is very simple: given a list of objects, ask the user which object in that list they'd like, then proceed to another page, passing the single item along. On the final page, there is a back button that skips the list-selector page by carrying the origin page's name in continually-passed context records.
Any help or potential workarounds would be appreciated. Thanks!