cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
tdupton
Helper II
Helper II

Navigate Context Variable

It seems I can't pass a variable via navigate any longer.  No matter what the variable is, I get the same error: "Context variables cannot be used here.  Context variable can only be bound to a single, specific screen".  Anyone else see this?Capture.PNG".

1 ACCEPTED SOLUTION

Accepted Solutions

I have never gotten a function to accept data like that or via a variable. It annoys me a lot. 🙂 

 

What you would have to do is make your Onselect an If.

 

If( ThisItem.Name = "Salary Change", Navigate(PANSalaryChangeScreen,Cover),

ThisItem.Name = "Transfer", Navigate(TransferPanScreen,Cover)

)

 

 

Something like that should work.

Shane - Microsoft MVP, YouTube, and PowerApps Consulting for when you are in a bind to get this fixed quickly. And finally we now have PowerApps Training

View solution in original post

10 REPLIES 10
Shanescows
Super User
Super User

Maybe we need more details? Where are you putting this property and on what type of control?

 

I just created a button and for OnSelect I did Navigate(Screen2,ScreenTransition.Cover,{BestPowerAppsConsultingCompany: "PowerApps911"}) and it works.

Shane - Microsoft MVP, YouTube, and PowerApps Consulting for when you are in a bind to get this fixed quickly. And finally we now have PowerApps Training
tdupton
Helper II
Helper II

I’ve tried OnSelect on a gallery and OnChange of a dropdown. Both give me the same error. I’ve tried the web client and Windows client with same results. I’ve done this dozens of times before so I don’t know if it’s some sort of a new bug or if I’m just having a senior moment.

ThisItem.Screen is what is confusing me. Try hardcoding Screen1 (or whatever your screen name is) and see if that works.

Shane - Microsoft MVP, YouTube, and PowerApps Consulting for when you are in a bind to get this fixed quickly. And finally we now have PowerApps Training

The gallery is filled with a collection.  That is where the thisitem.screen comes from.  Here is the collection:

 

ClearCollect(PanTypes,
{Name: "Salary Change", Screen: PANSalaryChangeScreen},
{Name: "Transfer", Screen: TransferPanScreen})

But, you know what, that was it.  I hardcoded a screen and it worked fine...I know I've set up a collection like this before and it worked fine.  Is there a syntax issue?

I have never gotten a function to accept data like that or via a variable. It annoys me a lot. 🙂 

 

What you would have to do is make your Onselect an If.

 

If( ThisItem.Name = "Salary Change", Navigate(PANSalaryChangeScreen,Cover),

ThisItem.Name = "Transfer", Navigate(TransferPanScreen,Cover)

)

 

 

Something like that should work.

Shane - Microsoft MVP, YouTube, and PowerApps Consulting for when you are in a bind to get this fixed quickly. And finally we now have PowerApps Training

View solution in original post

Thanks for the quick response, Shane.  That's a pain in the butt!  Smiley Frustrated


I hope they offer something like that for us soon.

Or a switch for little easier on the eye.

 

Switch(
  ThisItem.Random,
"Screen1",Navigate(Screen1, Fade),
"Screen2",Navigate(Screen2, Fade),
"Screen3",Navigate(Screen3, Fade),
"Screen4",Navigate(Screen4, Fade)
)

  Really annoying we can't just put the variable straight into the Navigate though.  Another use case, I have a Middle-Man screen hop where control property variables (colour, size ect) are defined on splash.  Some of these are taken from a "User Settings" table.  When user changes settings, it hops back to splash to re-do all the property variables then hops back to the screen the user was last on.

 

I had hoped I could just define a global variable containing the current screen's name on the OnClick of the Settings button (eg Set(gloSettingsReturn, Parent.Name)), then simply have Navigate(gloSettingsReturn) on my splash page, but nooo. Now I need a big fat Switch.

 What is strange is that it was working previously. I've got an app that I built about 2 years ago. Some formula involved variables to define the navigate screen and it was working perfectly fine. I updated the app today, and now I have this error 😞

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

PA Community Call

Power Apps Community Call

Next call is happening on April 21st at 8a PST.

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (76,015)