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

Dynamic screen reference in Navigation possible?

Hello,

 

I have a table setup with a TableRef column which contains the name of the Screen I want to navigate. I want to click an icon in my gallery and dynamically go to whichever screen that gallery entry refers to

 

The way im thinking something like this should work:

 

OtherTablesGallery.OnSelect = Navigate(OtherTablesGallery.Selected.TableRef,ScreenTransition.None)

 

But it doesn't work, I see a solution here: 

 

https://powerusers.microsoft.com/t5/PowerApps-Forum/Navigate-to-screen-selecting-element-from-the-li...

 

But I don't understand completely what it is doing and if its suitable.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Power Apps Staff irinak
Power Apps Staff

Re: Dynamic screen reference in Navigation possible?

Hi IanN,

 

The trick here is that you need to pass the screen as an object instead of just using the name. The post you found shows an example on how to do that.

  

1) Create a collection that has a mapping from screen name to screen object. For example:

 

ClearCollect(Screens, { Name: "Screen1", Target: Screen1 }, { Name: "Screen2", Target: Screen2 }, { Name: "Screen3", Target: Screen3 })

 

You can set the above when the first screen loads, i.e. Screen1.onSelect

 

2) Set your onSelect action to:

 

Navigate(Lookup(Screens, Name = OtherTablesGallery.Selected.TableRef, Target), None)

 

Hope this works for you!

 

Irina

View solution in original post

5 REPLIES 5
Highlighted
Power Apps Staff irinak
Power Apps Staff

Re: Dynamic screen reference in Navigation possible?

Hi IanN,

 

The trick here is that you need to pass the screen as an object instead of just using the name. The post you found shows an example on how to do that.

  

1) Create a collection that has a mapping from screen name to screen object. For example:

 

ClearCollect(Screens, { Name: "Screen1", Target: Screen1 }, { Name: "Screen2", Target: Screen2 }, { Name: "Screen3", Target: Screen3 })

 

You can set the above when the first screen loads, i.e. Screen1.onSelect

 

2) Set your onSelect action to:

 

Navigate(Lookup(Screens, Name = OtherTablesGallery.Selected.TableRef, Target), None)

 

Hope this works for you!

 

Irina

View solution in original post

IanN
Level: Powered On

Re: Dynamic screen reference in Navigation possible?

That works brilliantly, thank you for the extra explanation.

 

Perhaps a function could be added to turn a text value into a screen object e.g.

 

Object("ScreenName")

Anonymous
Not applicable

Re: Dynamic screen reference in Navigation possible?

Where do I enter this function: 

ClearCollect(Screens, { Name: "Screen1", Target: Screen1 }, { Name: "Screen2", Target: Screen2 }, { Name: "Screen3", Target: Screen3 })

 

 

sk9972252270
Level: Powered On

Re: Dynamic screen reference in Navigation possible?

Guys, I am new to PowerApps, I am using multiple screens (BroswerGallery) for Data view based on filters of same data source. Since the data format is same for all, I don't want multiple View, Add & Edit pages. Since upon each action it looks for a data source, I am finding difficult to use a single view, add & edit page. 

 

Need your help and step by step guidance.

 

Dharanya
Level: Powered On

Re: Dynamic screen reference in Navigation possible?

Hi,

 

I have used the same exact formula as below. But nothing happens and the screen stand still.

Formula in the On strat: ClearCollect(Screens,{Name:"Regular Pay",Target:RegularPay_Screen},{Name:"Payment Extension",Target:PaymentExtension_Screen})

Formula on the button:Navigate(LookUp(Screens,Name=drp_DOARequiredFor.Selected.Value,Target),ScreenTransition.None)

drp_DOARequiredFor is a drop down field and has the values, "Regular Pay","Payment Extension".

 

Please help me understand why it is not navigating to the respective screen. Also please note that there is no error in the formula

 

Helpful resources

Announcements
thirdimage

Coming Soon: T-Shirt Design Contest

Keep your eyes open for our upcoming T-shirt design contest!

thirdimage

Power Apps 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

Top Solution Authors
Top Kudoed Authors
Users online (6,539)