cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Yahya
Kudo Kingpin
Kudo Kingpin

Referring to a Control via a formula?

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")

 

14 REPLIES 14

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.

v-xida-msft
Community Support
Community Support

Hi @Yahya,

 

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:

ClearCollect(ScreenCollection,[[@ScreenA],[@ScreenB],[@ScreenC],...[@ScreenN]])

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):

Navigate(First(ScreenCollection).Value,ScreenTransition.Fade)

If you want to navigate to ScreenB, please take a try with the following formula:

Navigate(First(Remove(FirstN(ScreenCollection,2),FirstN(ScreenCollection,1))).Value,ScreenTransition.Fade)

If you want to naviagate to ScreenC, please take a try with the following formula:

Navigate(First(Remove(FirstN(ScreenCollection,3),FirstN(ScreenCollection,2))).Value,ScreenTransition.Fade)

If you want to naviagate to ScreenN, please take a try with the following formula:

Navigate(First(Remove(FirstN(ScreenCollection,N),FirstN(ScreenCollection,N-1))).Value,ScreenTransition.Fade)

 

More details about the FirstN function and Remove function in PowerApps, please check the following formula:

FirstN function, Remove function

 

More details about the Disambiguation operator (@) in PowerApps, please check the following article:

Disambiguation operator

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-xida-msft and @Eickhel,

 

Thanks. still not working for a reason or another. The thing I wish to achieve is to automate navigation of my PowerApp which I have designed to look like SharePoint online. see attached. 

 

 

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: -

 

Navigate(ThisItem.abcd_screenname,ScreenTransition.Cover)

 

It is needless to say that the above does not work.

 

Do you think there is a way?

 

 

Hey,

 

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.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (3,007)