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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Referring to a Control...
Power Apps
Unanswered

Referring to a Control via a formula?

(0) ShareShare
ReportReport
Posted on by 515

Is this possible in PowerApps? 

 

For instance I have 2 screens, (named ScreenA and ScreenB) want to have same button in both screens, to navigate, is this possible?

 

On Select: Navigate (ScreenVAR,fade,done)

 

while onload for ScreenA has: Set (ScreenVAR, "ScreenA")

 

and onload for ScreenB has: Set (ScreenVAR, "ScreenB")

 

Categories:
I have the same question (0)
  • Eickhel Profile Picture
    374 Most Valuable Professional on at

    Hey, 

     

    As far as I know, every screen has their own set of controls so an easy way could be just copying the button to each screen and then change their OnSelect or go your way:

     

    ScreenA - OnVisible: Set(ScreenVAR, "ScreenB")

    -- ButtonA: OnSelect: Navigate (ScreenVAR,fade,done)

     

    ScreenB - OnVisible: Set(ScreenVAR, "ScreenA")

    -- ButtonB: OnSelect: Navigate (ScreenVAR,fade,done)

     

    Is this what you wanted to accomplish?

  • Yahya Manasrah Profile Picture
    515 on at

    Hi @Eickhel, agreed they are 2 different buttons but i meant they have the same formula. 

     

    The below does not seam to work because of the topic of this discussion: Referring to a control via a formula? is this possible?

     

    If you look at my PowerApp screenshot, at the left, the side menu used to be buttons, but imagine buttons for +40 screens. I developed the menu eventually via a Gallery, and i was sucessful automate the formula to take me to the right screen via gallry on select.

     

    this is a the on select formula for the menu gallery 

     

    If(ThisItem.ecds_screenname="ScreenHome",Navigate(ScreenHome,ScreenTransition.Fade),If(ThisItem.ecds_screenname="ScreenProject",Navigate(ScreenProject,ScreenTransition.Fade),If(ThisItem.ecds_screenname="ScreenProjectDetails",Navigate(ScreenProjectDetails,ScreenTransition.Fade))))

     

    As you see, it is manually done, and this covers 3 screens only. I know I can use excel Concatenate to buld the formula for all screens, but i was thiking use a column in the gallery so my formula would be then super easy:

     

    ScreenHomeOn Visible: Set(CurrentScreen,"Home")

    ScreenProject On Visible: Set(CurrentScreen,"Project")

    etc.

     

    Menu Gallery OnSelect: Navigate(CurrentScreen, Fade, none)

     

    The issue is that OnSelect is not dealing with the variable CurrentScreen as ScreenName. I used Text(CurrentScreen), same.

    PowerApps1.PNG
  • Yahya Manasrah Profile Picture
    515 on at

    I think this would work if a control has a Name property then a variable can be assigned. i will be happy if there is another way.

  • Eickhel Profile Picture
    374 Most Valuable Professional on at
  • Yahya Manasrah Profile Picture
    515 on at

    Hi @Eickhel, Thanks.

     

    The problem is that in the proposed formula of 

     

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

     

    I have to call ScreenName for each option. And my objective is to calling screenname via a formula, so i dont make the furmula very long.

     

    But it does not seams to be working

  • Eickhel Profile Picture
    374 Most Valuable Professional on at

    True but what about the another proposed solution?

     

    https://powerusers.microsoft.com/t5/General-Discussion/Navigate-to-screen-selecting-element-from-the-list-through-list/m-p/9218/highlight/true#M404

     

    It uses a collection of screens.

  • Yahya Manasrah Profile Picture
    515 on at

    This might be the start to finda way, thanks for sharing! and thanks for being there..

     

    link solution says

    If you are using a dropdown or listbox control for the screen selection, please do the following:

     

        Dropdown1.Items = [Screen1, Screen2, Screen3]

        Dropdown1.OnChange = Navigate(Dropdown1.Selected.Value, Fade)

     

    I tried the easy scenario for testing: 

    the seconf line of the code gives an error: "The function 'Navigate' has some invalid arguments"

  • Eickhel Profile Picture
    374 Most Valuable Professional on at

    OK, I think I got a way. First I created a collection with all the screens of this test app (keep in mind the @):

     

    ClearCollect(Screens,[[@FormScreen1],[@Screen1]])

    Then I created a button with this code in the OnSelect:

    Navigate(Last(Screens).Value, ScreenTransition.None)

    It's working.

     

    You need to change the logic for when or where to navigate... but I think this might work for you.

  • Yahya Manasrah Profile Picture
    515 on at

    Hi again my friend @Eickhel. not seams to be working 😞

     

    if you are sure can you package for me the test app?

  • Eickhel Profile Picture
    374 Most Valuable Professional on at

    Sure, I've created a Contact template app and added a Waffle button on the main screen that goes to the last screen of the Screens collection. The collection gets created in the OnVisible property of the main screen so you might want to test this on a published version because the designer doesn't always trigger the OnVisible correctly.

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 404

#2
timl Profile Picture

timl 344 Super User 2026 Season 1

#3
WarrenBelz Profile Picture

WarrenBelz 320 Most Valuable Professional

Last 30 days Overall leaderboard