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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Can you setup a Galler...
Power Apps
Answered

Can you setup a Gallery to select a Screen to navigate to?

(0) ShareShare
ReportReport
Posted on by

Hi All,

 

I've setup a Home Screen Gallery and I'd like to setup the onselect to navigate to different screens.

 

I thought I'd have to put in something like 

 

Navigate(ScreenTitle.Selected, ScreenTransition.Fade)

 

It's not working though.

 

Thanks in advance for any help you can provide

 

Regards

 

 

Dave

Categories:
I have the same question (0)
  • CarlosFigueira Profile Picture
    on at

    You can do that, if you define the screen name (not a string containing the screen, that difference is important) as one of the items of the collection that you use for the gallery in the home screen.

     

    If your collection is local, then you need to add a new item to it. For example, this is the (verbatim) value of the Items property of the gallery in the home screen for an app that I've built to use internally to manage DRI duties (some internal process we have in our team):

    Table(
     {Title: "Before DRI", Screen: BeforeDRIScreen, Subtitle: "Things to do before you are a primary DRI"},
     {Title: "During DRI", Screen: DuringDRIScreen, Subtitle: "What to do during the week when you are the DRI"},
     {Title: "After DRI", Screen: AfterDRIScreen, Subtitle: "What to do to ensure a good transition to the next DRI"})

    In my app I have 4 main screens (there are also others, but it doesn't matter for this example): HomeScreen, BeforeDRIScreen, DuringDRIScreen, AfterDRIScreen. The OnSelect property of the controls within the gallery template is set to the following:

    Navigate(ThisItem.Screen, ScreenTransition.Cover)

    If your table of contents for the main screen comes from a data source, then you'll need to use some logic on the navigation to choose which screen to go (as I mentioned, you cannot navigate to a screen based on a value containing the screen name - you can consider creating a new item in the PowerApps Ideas board for this feature if you feel that it's important). For example, if the name of my screens came from a connected data source and only had the Title/Subtitle properties, I could have an OnSelect value like the one below:

    If(
     Title = "Before DRI", Navigate(BeforeDRIScreen, ScreenTransition.Fade),
     Title = "During DRI", Navigate(DuringDRIScreen, ScreenTransition.Fade),
     Title = "After DRI", Navigate(AfterDRIScreen, ScreenTransition.Fade))
  • Community Power Platform Member Profile Picture
    on at

    As far as I know, there is currently no way to refer to screen objects by a string containing their name. As previously suggested, you would have to create a table/collection containing references to the actual screen objects.

     

    For example, you can have a gallery that displays a list of buttons.

    But first, you should have a collection that contains screen references. You can set it up like this:

    ClearCollect(ScreenReferences, Table(
     { Title: "Screen One", ScreenObject: ScreenOne },
     { Title: "Screen Two", ScreenObject: ScreenTwo },
     { Title: "Screen Three", ScreenObject: ScreenThree }
    ))

    Add more records under the Table() function as needed. Then use that to populate the gallery.

     

    Then, in your gallery, you can have a button object in the template.

    The button object should have properties like these:

    Text: ThisItem.Title
    OnSelect: Navigate( ThisItem.ScreenObject, None )

    Clicking a button on the gallery would navigate the user to the screen that is referenced.

     

    There are a couple of things that are good to know about this method though.

    1. You can't pass context variables via this method. For some reason, you have to reference the screen object directly in order to pass a context variable. For example,
      Navigate( ScreenOne, None, { ContextVar: "Some Value" } )
    2. Since this is a gallery, the other buttons would be automatically generated. However, in Edit Mode, if you click on any button other than the first (the template button), the OnSelect would run and navigate you away from it.
  • Community Power Platform Member Profile Picture
    on at

    Hi All,

     

    Still not having any luck with this, I have this copied this from the OnSelect field from within my gallery. Error being given "This function Navigate has some invalid arguments".

     

    ClearCollect(ScreenReferences, Table(
    { Title: "NHVAS Maintenance Minimum Checklist", ScreenObject: NHVASMaintenanceChecklist },
    { Title: "TruckSafe Minimum Checklist", ScreenObject: TrucksafeMinChecklist },
    { Title: "NHVAS and Trucksafe Minimum Checklist", ScreenObject: NHVASTrucksafeChecklist },
    { Title: "Mass Management Daily Vehicle Checklist", ScreenObject: MassManagementChecklist },
    { Title: "Vellex Daily Vehicle Checklist", ScreenObject: VellexDailyVehicleChecklist }
    )) -
    Navigate(ThisItem.ScreenObject, Fade )

  • Community Power Platform Member Profile Picture
    on at

    I've also tried this in the Onselct field of the image within the Gallery I'm using as a button and still no luck. Error given "Invalid Argument Type"

     

     

    If(
    Title = "NHVAS Maintenance Minimum Checklist", Navigate(NHVASMaintenanceChecklist, ScreenTransition.Fade),
    Title = "TruckSafe Minimum Checklist", Navigate(TrucksafeMinChecklist, ScreenTransition.Fade),
    Title = "NHVAS and Trucksafe Minimum Checklist", Navigate(NHVASTrucksafeChecklist, ScreenTransition.Fade))

  • Verified answer
    CarlosFigueira Profile Picture
    on at

    @Anonymous wrote:

    I've also tried this in the Onselct field of the image within the Gallery I'm using as a button and still no luck. Error given "Invalid Argument Type"

     

     

    If(
    Title = "NHVAS Maintenance Minimum Checklist", Navigate(NHVASMaintenanceChecklist, ScreenTransition.Fade),
    Title = "TruckSafe Minimum Checklist", Navigate(TrucksafeMinChecklist, ScreenTransition.Fade),
    Title = "NHVAS and Trucksafe Minimum Checklist", Navigate(NHVASTrucksafeChecklist, ScreenTransition.Fade))


    If you reduce the formula to its minimum:

    If(Title = "NHVAS Maintenance Minimum Checklist", Navigate(NHVASMaintenanceChecklist, ScreenTransition.Fade))

    Do you still see the error? If yes, then try to hover across the two parameters of the function, to see if the error has more information.

     

    Do you not see the error? Then start adding the other options one at a time until you see an error; when you do, hover on the formula bar to see if you get more information about it.

  • Community Power Platform Member Profile Picture
    on at

    Hi.

     

    If you're going to use my way (CarlosFigueira's method is also valid), you should define the collection before the gallery. I usually do mine on the OnStart property of the first screen but that needs the app to be restarted if make edits in there (Because OnStart doesn't get executed in the F5 Preview). For now, you can do it in the OnVisible property of the screen your gallery is in.

     

    ClearCollect(ScreenReferences, Table(
    { Title: "NHVAS Maintenance Minimum Checklist", ScreenObject: NHVASMaintenanceChecklist },
    { Title: "TruckSafe Minimum Checklist", ScreenObject: TrucksafeMinChecklist },
    { Title: "NHVAS and Trucksafe Minimum Checklist", ScreenObject: NHVASTrucksafeChecklist },
    { Title: "Mass Management Daily Vehicle Checklist", ScreenObject: MassManagementChecklist },
    { Title: "Vellex Daily Vehicle Checklist", ScreenObject: VellexDailyVehicleChecklist }
    ))

     

    Then, in your gallery, do this for the Items property.

    ScreenReferences

    Then, create a button in the gallery template with the following properties:

    Text: ThisItem.Title
    OnSelect: Navigate(ScreenObject, ScreenTransition.None)

    And another thing: Are the objects assigned for ScreenReferences.ScreenObjects screens? If they're not (because the names suggest they are radio objects), then that may be where the errors are coming from.

     

    Let me know if that works.

  • Community Power Platform Member Profile Picture
    on at

    Thanks Everyone,

     

    If finally got it using the formula's below.

     

    If(
    Title5.Text = "NHVAS Maintenance Minimum Checklist", Navigate(NHVASMaintenanceChecklist, ScreenTransition.Fade),
    Title5.Text = "TruckSafe Minimum Checklist", Navigate(TrucksafeMinChecklist, ScreenTransition.Fade),
    Title5.Text = "NHVAS and Trucksafe Minimum Checklist", Navigate(NHVASTrucksafeChecklist, ScreenTransition.Fade))

  • JK94X Profile Picture
    on at

    @CarlosFigueira 
    I have the same issue and didn't get it to work.

    My goal is to navigate to different screens from my gallery using the arrows.

    I've tried to set the onselect of my arrow in my gallery to the following:

    If(Title2 = "ScrewConfig1"; Navigate(Screw_Configuration_1; ScreenTransition.Fade))

      

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard