web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Navigate to a screen b...
Power Apps
Unanswered

Navigate to a screen by it's name

(3) ShareShare
ReportReport
Posted on by 78

Let's say I have a dropdown control in my PowerApps application named Nav with the next items:

 

[
 "1. Calculator", 
 "2. Counter", 
 "3. API", 
 "4. Collections", 
 "5. Dropdown", 
 "6. Acceleration", 
 "7. Camera"
]

 And I want to navigate to a screen by it's name. Something like:

Navigate(Nav.Selected.Value, ScreenTransition.Cover)

Is it possible to do somehow? Or is there a function that returns a control by it's name?

Navigate(GetControl(Nav.Selected.Value), ScreenTransition.Cover)

Because now I have to use If function to navigate in the app like this:

Navigate(If(
 "1" in Nav.Selected.Value, Screen1, 
 "2" in Nav.Selected.Value, Screen2, 
 "3" in Nav.Selected.Value, Screen3, 
 "4" in Nav.Selected.Value, Screen4, 
 "5" in Nav.Selected.Value, Screen5, 
 "6" in Nav.Selected.Value, Screen6, 
 "7" in Nav.Selected.Value, Screen7), 
ScreenTransition.Cover)

which does not look very nice. Is there more elegant solution? 

Categories:
I have the same question (0)
  • Verified answer
    CarlosFigueira Profile Picture
    on at

    You cannot (currently) get a screen (or other controls) by its name - feel free to create a new suggestion in the Ideas board for that.

     

    But for your specific scenario, you have a better alternative. Although you cannot get a control by its name, you can set a control as a property in the items collection for your dropdown, as shown below:

    Table(
     { Text: "1. Calculator", Screen: Screen1 },
     { Text: "2. Counter", Screen: Screen2 },
     { Text: "3. API", Screen: Screen3 },
     { Text: "4. Collections", Screen: Screen4 },
     { Text: "5. Dropdown", Screen: Screen5 },
     { Text: "6. Acceleration", Screen: Screen6 },
     { Text: "7. Camera", Screen: Screen7 })

    And in the action where you want to navigate (OnChange) you can call the navigate function with the value of the selected item in the dropdown:

    Navigate(Dropdown1.Selected.Screen, ScreenTransition.Fade)

    One of the advantages of this approach is that the definitions are in the same location - there's smaller risk for you to change the text of the dropdown and forget to change the formula elsewhere.

  • Brian Dang Profile Picture
    3,976 on at

    Good! I am glad someone else is interested in this. I started an idea in the old TechNet forum for Indirect References, but it did not get traction. I don't think most users call it an indirect reference.

  • dtsiniavskyi Profile Picture
    78 on at

    Yeah, thanks. This solution is much better. But how does PowerApps know whan to show as a text item in dropdown? We have complex object with two properties (columns) of type string and control named Text and Screen. Am I supposed to name property (column) exactly Text so it's value will be selected by default to display in the dropdown? Or is it just the first column that is picked as a displayable one? Because I tried different combinations of types and names and can not spot the pattern.

  • Verified answer
    CarlosFigueira Profile Picture
    on at

    PowerApps will try to make an educated guess the column to use to display in the dropdown. If your object has one column of type string, and one column of type <Screen> (or control), the option is fairly easy - pick the former.

     

    There are situations where it will choose incorrectly, though. For example, imagine that this is your data source in the Items property of the dropdown:

    Table(
     { Text: "1. Calculator", Screen: Screen1, AnotherText: "Calculator" },
     { Text: "2. Counter", Screen: Screen2, AnotherText: "Counter" },
     { Text: "3. API", Screen: Screen3, AnotherText: "API" },
     { Text: "4. Collections", Screen: Screen4, AnotherText: "Collections" },
     { Text: "5. Dropdown", Screen: Screen5, AnotherText: "Dropdown" },
     { Text: "6. Acceleration", Screen: Screen6, AnotherText: "Acceleration" },
     { Text: "7. Camera", Screen: Screen7, AnotherText: "Camera" })

    PowerApps will choose one of them, but what you really wanted was the other one. So you can select the Dropdown, then select the View option in the Ribbon, then Advanced. You will see all the properties of the control, and under the Items property you will see a Value "subproperty", which you can use to select which of the fields to use.

    Dropdown.PNG

  • hintbw-abc Profile Picture
    117 on at

    This was some great guidance to help build some dynamic navigation in an app. I used a collection is generated OnVisible for a gallery and then based the gallery control off of the items in the collection. The tip about creating a column in a table that is of a screen type also works with a collection (this might be obvious, but just wanted to confirm that it works equally well).

     

    +100 for this solution as it helped me provide some navigation within the app. I wish there was a better way to manage the list of navigation items rather than a collection that is generated on viewing the navigation screen.

  • ZiadHamandi Profile Picture
    15 on at

    can you please post your formula.

    what i am try to do is:

    Navigate(LookUp(CLTSvc,SvcRqst = ScheduleGal.Selected.SchFMSvcID1.Text,SvcCore),ScreenTransition.CoverRight)

     

    I tested the look up and it has no issues resolving. when combined with Navigate it becomes an issue. I understand that first argument should be a control or screen.

     

    Is there a way to have a button navigate based on a lookup value from a collection?

  • Realy8 Profile Picture
    14 on at

    If(ThisItem.ID_Menu_main=1,Navigate(Teacher,ScreenTransition.Cover),
    If(ThisItem.ID_Menu_main=2,Navigate(Student,ScreenTransition.Cover),
    If(ThisItem.ID_Menu_main=3,Navigate(Report,ScreenTransition.Cover),
    If(ThisItem.ID_Menu_main=4,Navigate(About,ScreenTransition.Cover),
    Navigate(Student,ScreenTransition.Cover)))))

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard