cancel
Showing results for 
Search instead for 
Did you mean: 

Let Navigate() also use variables

I would like to be able to pass a variable to the Navigate() function. e.g. Navigate(varScreen), where varScreen is set elsewhere in the app, perhaps a string screen name or num screen id.

https://powerusers.microsoft.com/t5/Building-Power-Apps/Navigate-Context-Variable/td-p/114663

https://powerusers.microsoft.com/t5/Building-Power-Apps/How-to-expand-a-variable-to-a-screen-name-fo...

Someone here suggest Eval() function as another alternative.

Status: New
Comments
BenGin
Advocate II

yes please implement this. I have used this great Navigation menu from Matthew Devaney and the end users love it.

However, there are App performance issues because when all the Screen Names are put into the App OnStart property, the App will initiate everything in all the screens that are mentioned. 

From Matthew Devaney's example:

"The menu options will be stored as a table inside of a variable as opposed to a collection because they are not meant to be changed while the app is running. Put this code in the OnStart property of the app. Then run App OnStart."

Set(colSidebarMenu,
  Table(
    {Value: "News", Icon: Icon.Newspaper, Screen: 'News Screen'},
    {Value: "Science", Icon: Icon.CameraAperture, Screen: 'Science Screen'},
    {Value: "Travel", Icon: Icon.Airplane, Screen: 'Travel Screen'},
    {Value: "Budget", Icon: Icon.Money, Screen: 'Budget Screen'},
    {Value: "Maps", Icon: Icon.Waypoint, Screen: 'Maps Screen'},
    {Value: "Settings", Icon: Icon.Settings, Screen: 'Settings Screen'}
  )
)

 The Screens are passed into the Common Component and used inside a "Navigate" so that when a user clicks on a menu item, they will be navigated to the corresponding screen.