cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Steve130
Frequent Visitor

Global variables for navigation

Hello, I was wondering if it's a good idea to use global variables to track navigation through a PowerApp, and if so how to implement this. My app will start with a home page, and from there the user can choose options that'll take them down a hierarchy. For instance, they'll start with several "organizations" to choose from. They pick one organization and are taken to a page with all the "suborganizations" within that organization, and so on.

 

Currently I'm trying to do this with global variables. After selecting an organization, I use the Navigate and Set functions to navigate to the appropriate page and set a global variable containing their choice. I want this global variable to do double duty: one, to filter which suborgs, etc are shown later on; and two, to appear in a breadcrumb trail that'll let the user easily see their choices thus far and go back if needed. However, I'm not experienced with PowerApps and don't know whether this is even feasible. I don't know how to access global variables in other pages either. I hope someone can point me in the right direction.

3 REPLIES 3
Ismael_Novo
Resolver III
Resolver III

Hello Steve130,

 

Global variables defined with SET are accessible from the entire application. If you create a component to make a menu it seems that they are not visible but in reality you only have to activate an option for the component to have access to the global scope.

 

The local variables UpdateContext are the ones that are only visible in the view where they are declared.

 

What you comment does not seem bad idea, if you find some more concrete problem comment it and we analyze it.

 

Greetings.

WarrenBelz
Super User
Super User

Hi @Steve130 ,

I don't think it will save you much time, but you can make a collection like this

ClearCollect(
   colScreens,
   {
      Function: "Case1" Screen: MainScreen,
      Function: "Case2" Screen: EditScreen,
      Function: "Case3" Screen: ViewScreen
   }
)

and do a LookUp to the screen, but to be honest, it is probably shorter to simply type in the screen name.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

Hi Ismael_Novo,

 

I apologize for the delayed response, thank you. You said I have to activate an option for a component to gain access to the global scope. What is it and how do I activate it?

 

Also to elaborate on what I'm trying to do: I have a global variable named capability that I want to use to filter a list in another page. This is what I attempted:

Filter('Table_of_services', "capability" in Lower(ParentCapability))

 but it obviously didn't work.

 

I appreciate the responses.

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Top Solution Authors
Top Kudoed Authors
Users online (1,132)