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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to link 2 gallerie...
Power Apps
Answered

How to link 2 galleries to one detail screen

(0) ShareShare
ReportReport
Posted on by 102

I've one gallery 'BrowseGallery2' where you can browse and filter all employees, and then click on button to get to their individual details in 'detailscreen1'.

Also I got another gallery 'Gallery1' in another screen where every employee belonging to one department shows up (based on predefined values), there is also a button for each employee linking to 'detailscreen1'. And I want to link that gallery to the said same detail screen but it seems not possible?!

 

I've tried with following codes in detailscreen1

 

BrowseGallery2.Selected&Gallery1.Selected

and this 

BrowseGallery2.Selected||Gallery1.Selected

Neither works, do you know how to?

 

Thanks in advance

Categories:
I have the same question (0)
  • hpkeong Profile Picture
    2,944 on at

    Hi

     

    Looks like you are trying to do "Merging"?

    In normal case, you can only CLICK on one gallery and navigate to another detail screen based on the "Selected" results.

    So, I don;t it is possible to "Click: two gallery at one time.

    What you are looking for might be:

    - Filter based on two "Criteria", not two gallery selection.

     

    Hope I am right.

    TQ

  • Verified answer
    Brian Dang Profile Picture
    3,976 on at

    Hi, 

    I can think of two ways of doing this.

    1. Use a condition around the Items property of the Display Form Viewer (on detailscreen1). Use a context variable to determine which situation the user is in.
    2. Upon clicking the button to Navigate, also Collect the record for viewing.

    Both methods will only work if BrowseGallery1 and Gallery2 draw information from the same datasource--in other words, they must have identical columns or it won't work properly.

     

    Method 1

    The third argument for Navigate can transfer a context variable.

     

    For the screen browsing/filtering all employees:
    Navigate(detailscreen1,Fade,{variable: 1})
    
    For the screen looking at a department of employees:
    Navigate(detailscreen1,Fade,{variable: 2})

    The variable created will determine what situation the user will be in. When the variable is 1, we will make the Display Form Viewer show the information selected in BrowseGallery2. When the variable is 2, we will make the Display Form Viewer show information selected in Gallery2.

     

     

    Set the Items property of the Display Form Viewer to show the desired record:

     

    If(variable=1,BrowseGallery2.Selected,
     variable=2,Gallery2.Selected
    )

    Sometimes that may not work depending on the configuration of your galleries. You may instead opt to use the unique identifier in your datasource to determine exactly which record you're referring to. In this case, RecordId refers to a field that uniquely identifies each row:

     

    If(variable=1,First(Filter(datasource,RecordId=BrowseGallery2.Selected.RecordId)),
     variable=2,First(Filter(datasource,RecordId=Gallery2.Selected.RecordId))
    )

    So in method 1, the variable determines what record the user will be viewing.

     

    In method 2, you can opt to Collect the exact record you want to avoid ambiguity and variables altogether.

     

    Method 2

    Program the Buttons you use for navigating to Collect the exact record you want.

    ClearCollect(viewEmployee,ThisItem);
    Navigate(detailscreen1,Fade)

    The formula above should work, but if there is ambiguity, you can use this to be more specific:

    ClearCollect(viewEmployee,First(Filter(datasource,RecordId=ThisItem.RecordId)));
    Navigate(detailscreen1,Fade)

     

    The same formula should work for buttons in both BrowseGallery1 and Gallery2 since ThisItem is relative to the stated gallery.

     

    Now that you have collected a record you wish to show, you can configure the Items property of your Data Form Viewer to show the first record of the temporary collection you made:

    First(viewEmployee)

    Let me know how this works out for you.

  • tofsweden Profile Picture
    102 on at

    Did the first method, worked like a charm. Thank you very much!

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 519

#2
WarrenBelz Profile Picture

WarrenBelz 439 Most Valuable Professional

#3
Vish WR Profile Picture

Vish WR 433

Last 30 days Overall leaderboard