cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AgarDoge
Helper I
Helper I

Filtering a Gallery

Hi,

 

I have a question about filtering a gallery with the result from a different data source. I have a gallery, GalleryExample, that displays the records of my SharePoint data source DataSrcExample. Since there are users with different roles that can access this screen, I have filtered the gallery based on the user's role. However, for one of the views, "Employee", I want to filter it such that the gallery only shows those records where the employee's name is associated with that record. However, this is linked to another data source, Location Personnel, that contains a list (Column name "Primary Contact Names") that contains the name of employees for every location. So I want to filter the DataSrcExample table by comparing values in the Location Personnel source. However, I am unsure as to how to perform this comparison. Below was my best attempt so far by using in  to try, but I wasn't sure how to incorporate everything together. 

 

 

 

SortByColumns(
    Filter(
        'DataSrcExample',
        If(
            selectedView = "Other",
            'Name Field' = Concatenate(
                Office365Users.MyProfile().GivenName,
                " ",
                Office365Users.MyProfile().Surname
            ),
            selectedView = "Manager",
            ...,
            selectedView = "Employee",
                 User().FullName in 'Location Personnel'.'Primary Contact Names',
            true
        ),
        If(
            colName = "Tracking ID",
            StartsWith(
                TrackingID,//Tracking ID
                SearchBarDiscrep.Text
            )
       ....

 

 

 

 

Example:

 

Current User: Bill Orange

DataSrcExample (filled in via a form on PowerApps):

Tracking IDLocation
0001Washington DC
0002New York City
0003London

Location Personnel:

Employee LocationPrimary Contact Names
Washington DCJill Apple, Bill Orange, Carey Grape, Joseph Pear
New York CityBarry Bonds, Sammy Sosa
LondonBill Orange, Nancy Pear, John Appleseed

 

Filtered Gallery to show only those records where "Bill Orange" is an employee:

Tracking IDLocation
0001Washington DC
0003London

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
CNT
Super User
Super User

@AgarDoge Change this part of the code to,

selectedView = "Employee",
Location=LookUp('Location Personnel' User().FullName in 'Primary Contact Names').'Employee Location',

View solution in original post

1 REPLY 1
CNT
Super User
Super User

@AgarDoge Change this part of the code to,

selectedView = "Employee",
Location=LookUp('Location Personnel' User().FullName in 'Primary Contact Names').'Employee Location',

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (3,346)