Skip to main content

Notifications

Community site session details

Community site session details

Session Id : 3ZClRIE4ThMfwhI2YmJC87
Power Apps - Power Apps Pro Dev & ISV
Answered

How to change Screens with OnSelect using components?

Like (0) ShareShare
ReportReport
Posted on 7 Oct 2024 05:41:47 by 80
I got this component field:  how do I upon on click change the screens 
I am using TargetScreen: App.ActiveScreen, how should I change it to solve the error message?
  • Verified answer
    Nandit Profile Picture
    1,563 Super User 2025 Season 1 on 07 Oct 2024 at 07:29:00
    How to change Screens with OnSelect using components?
     
    Collect all your navigation items in a variable using OnStart:
    Set(
        colSidebarMenu,
        Table(
            {
                Title: "My Leave Request",
                Screen: LeaveBalance
            },
            {
                Title: "My Leave Balance",
                Screen: LeaveRequest
            }
        )
    )
    Add a Custom Input property to your Component, "ItemsTable", and add the following code it:
    Table(
        {
            Title: "Item 1",
            Screen: App.ActiveScreen
        },
        {
            Title: "Item 2",
            Screen: App.ActiveScreen
        }
    )
    In your Component, update the Items property of your Gallery to 
    ComponentName.ItemsTable
    OnSelect Property of your Gallery:
    Navigate(ThisItem.Screen)
    Add your Component to the screens and add your Variable to the ItemsTable input property:
    colSidebarMenu
    And that's it!
     
    Here's step-by-step guidance on this topic by Matthew Devaney: https://www.matthewdevaney.com/power-apps-navigation-menu-component/
     
    Hope this helps. 
     
    Kind regards. 
    Nandit
     
    If this answers your query, please mark this response as the answer.
    If its helpful, please leave a like. Thanks!
  • Suggested answer
    DBO_DV Profile Picture
    4,612 Super User 2025 Season 1 on 07 Oct 2024 at 06:51:57
    How to change Screens with OnSelect using components?
    Hey Philbert9879,
     
    Could I ask you what you are trying to achieve? 
    What you doing right now will just keep you to stay on the screen that you are on right now. App.ActiveScreen is the Screen that is visible at the moment
     
    so your If Statement will always result to being wrong since you have it on Home screen and this will always result in you staiyng on the home screen since every target screen is App.ActiveScreen. 
     
    Either you use The actual Screen titles to get your table to work or you can use a Switch statement something like this: 
    If(ThisItem.Title<>Actual Screen name or title, 
      Navigate(
        Switch(
          ThisItem.Title, 
          "My Leave Balance",
          'title of Leave balance screen',
          "Company Holiday",
          'Expected Screen')
    )
    )
    If this Solved your problem please accept it as solution so others can find it as well. 
    If it helepd in any other way consider giving it a like so wa can keep supporting eachother. 
     

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Power Apps Pro Dev & ISV

#1
WarrenBelz Profile Picture

WarrenBelz 55 Most Valuable Professional

#2
mmbr1606 Profile Picture

mmbr1606 49 Super User 2025 Season 1

#3
Michael E. Gernaey Profile Picture

Michael E. Gernaey 35 Super User 2025 Season 1

Overall leaderboard