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")
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.
Could you please share a bit more about your scenario?
Do you want to navigate to different screens using one Button control with same formula?
When you use the Navigate function within your app, you must specify which screen you want to display or navigate to firstly.
If you want to use a variable to store the Screen you want to display or navigate to when one screen is loading, I afraid that there is no way to achieve your needs in PowerApps currently.
I agree with @Eickhel's thought almost, you could consider take a try to store all screens within your app. Please set the OnVisible property of your Menu Gallery screen to following formula:
Note: ScreenA, ScreenB,...ScreenN represents the screen name within your app.
The OnSelect property of the Navigate button set to following formula (Naviagte to ScreenA):
If you want to navigate to ScreenB, please take a try with the following formula:
If you want to naviagate to ScreenC, please take a try with the following formula:
If you want to naviagate to ScreenN, please take a try with the following formula:
More details about the FirstN function and Remove function in PowerApps, please check the following formula:
More details about the Disambiguation operator (@) in PowerApps, please check the following article:
I have shared 2 screens of my PowerApp. Home and Project.
in both, please forget about the gallery showing country it is for testing only.
The Gallery at the left is MenuGallery and it reads from CDS entity JuliApp Menu. It can be a collection.
The point of using a gallery to navigate has many useful reasons such as it can extend to much more App/device Screen height, also that Red highlight of the current screen is needless to say nice/useful, which I achieve easily, also location is fixed. If Buttons are used then, you know..
In attachments 4 and 5, I show the formula I use in OnSelect of that Gallery that exists in both Screen000_Home and Screen050_Project, and navigation works perfectly.
My point is that, for +60 screens, that formula really will be long, and I am afraid will have negative effect of App performance. So, I wish use a formula like this as simple as this for OnSelect the Menu Gallery in all screens: -
It is needless to say that the above does not work.
Do you think there is a way?
I think the methods provided by both @v-xida-msft and me could help you build this type of interface but I'm not really sure about the issues you're facing with this.
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Join us for the next call on June 15, 2022 at 8am PDT.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.