cancel
Showing results for 
Search instead for 
Did you mean: 
audrieg

Conditional Navigation - Triggered by User Selection

Most of the time we are adding navigation via an icon in the top navigation, or a button push such as a "Next" prompt. In those cases, it is very easy to auto-build our navigation formulas by selecting the object which will be the trigger, and using the Action Menu to add navigation.

 

Tip: Did you notice that you can select the screen and the transition directly from the Navigation drop downs on the Action tab? When you do that PowerApps builds the navigation formula for you! Easy peezy!

 

screennavigation.PNG

 

A slightly different scenario:

On the other hand, there are times when we want to determine navigation based on user selection somewhere on the current screen. In the sample below, we built a ficticious sample app which returns feature statistics for our sprint. In addition, it allows the Program Managers to suggest new features (driven by customer EBC) by clicking on the small push pin on the lower right hand corner of the screen.

 

Screen1.PNG

 

Here's the catch: Each Product has a different set of field values required to suggest a feature....so a different form is needed based on the product selection (enablement often leads to diversity in intake systems - smiles). Therefore, we have a different request screen in the app for each product name.

 

Not to worry! This is an exceptionally easy thing to do in PowerApps. The way I choose to do it is by setting the OnSelect property for the push pin icon in this way:

 

Step 1: Select the Push Pin Icon

Step 2: Set the OnSelect property with a conditional format similar to this one (change the screen names and drop down names as needed):

 

If("A" in ddProductName.Selected.Value,Navigate(ScreenProductA, ScreenTransition.Fade),
If("B" in ddProductName.Selected.Value,Navigate(ScreenProductB, ScreenTransition.Fade),
Navigate(ScreenProductC, ScreenTransition.Fade)))

 

Translated the above formula really means:

If "A" is found in the selected Product Name then navigate to the screen named "ScreenProductA", or if "B" is found in the selected Product Name then navigate to the screen named "ScreenProductB", ELSE navigate to the screen named "ScreenProductC").

 

Any operator can be used (such as equals) instead:

If(ddProductName.Selected.Value="Product A",Navigate(ScreenProductA, ScreenTransition.Fade),
If(ddProductName.Selected.Value="Product B",Navigate(ScreenProductB, ScreenTransition.Fade),
Navigate(ScreenProductC, ScreenTransition.Fade)))

 

The If() function is a handy tool for many types of conditions including navigation. I've written it completely out here for the sake of readability, but you can abbreviate nested "If" statements as broken down in our formula reference here:

https://powerapps.microsoft.com/en-us/tutorials/function-if/

 

I hope this mini-blog helps you to enjoy, and to enhance your PowerApps today!

 

Audrie

Comments

Hi, I have embedded several Power BI tiles (set up as individual "dashboard" screens), and I'd like to conditionally navigate to these screens based off of user selection from another screen.  The navigation should be based off a specific item selected from a Gallery.  The Gallery is connected to a OneDrive Excel sheet.  

 

I have a column in my OneDrive Excel sheet labeled 'Product Name' which is being referenced in my Gallery.  Depending on which 'Product Name' is selected, my app takes me to a Form page (called Details), which provides more details about the Product.  The details of the product are also in the Excel sheet, so the form text all refers back to Parent.Default.  It is from this Details form which I want to navigate to the appropriate Power BI sheet, via a button.  However, the navigation is condtional based on which product was selected from the Gallery.   How should I write my formula to navigate this?

 

Thanks.

Meet Our Blog Authors
  • PowerApps Community Mentor 2018, Practicing surgeon and former Professor of Surgery, University of Illinois, Chicago.
  • Jill of All Trades (Power Apps, SharePoint, PowerShell, Exchange, Power Automate and odds & ends of assorted other things)
  • I am the Owner/Principal Architect at Don't Pa..Panic Consulting. I've been working in the information technology industry for over 30 years, and have played key roles in several enterprise SharePoint architectural design review, Intranet deployment, application development, and migration projects. I've been a Microsoft Most Valuable Professional (MVP) 12 consecutive years and am also a Microsoft Certified SharePoint Masters (MCSM) since 2013.
  • I'm Tim Leung - a PowerApps builder. In addition to PowerApps, my main interests include building software with SQL Server and Microsoft .NET. I'm the author of 'Beginning PowerApps' - the first published book on PowerApps. You can buy this from Amazon and other leading bookstores.
  • Systems developer
  • My name is Timothy Shaw and I create digital solutions using the Power Platform, Office 365, and Azure SQL and handle the IT for a small company in the energy sector. When not building the future :), I enjoy playing guitar, good (or really bad!) sci-fi, Xbox therapy, and hanging with my wife and son. Twitter: @ShortForTim