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

Filtering a gallery by using a value in another list

Hello, everyone. 

 

I am brand new to PowerApps, and I am struggling with my first app.

 

The goal is essentially to have a personalized user home page with links to various "Favorites" that the user chooses from a list.

 

What I have done is created 2 SharePoint lists:

TestAppsList: holds a list of information about applications (App name, web link, icon, etc.)

UserApps: holds the information about a particular user's preference to have the app as a favorite. (User email, App name, preference(boolean), and a column to identify each record by app and user(concatenated user email and app name))

 

What I am trying to do is have 2 galleries.

 

Gallery1: Shows a list of all of the apps in the TestAppsList

Gallery2: Shows a list of all of the apps in the TestAppsList where the user has marked the app as a favorite (In UserApps: preference=true)

 

I am using a toggle in Gallery1 to set the prefence value in UserApps

 

I cannot get Gallery2 to only show the values that are "favorites".

 

I have tried many things that did not work, but the closest I got was:

(in the Items field for Gallery2)

Filter(TestAppList, TextInput1.Text in ShowColumns(Filter('UserApps', Favorite = 1), "UserApp").UserApp)

 

For some reason, this is still showing all of the apps in the list, instead of only the "favorited" ones

 

I also tried Filter(TestAppList, If(Toggle1.Value = true , StartsWith(Title, Title1.Text))), but this only shows the last item that was toggled.

 

Any help would be very much appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: Filtering a gallery by using a value in another list

@cjnunn 

Can you explain a little more on Gallery2 - you state listing all of the apps in the TestAppsList.

Are you stating that only the apps that are marked as favorites should appear?

 

If so, your formula for the Items property should be the following:

Filter(TestAppList, AppName in Filter('UserApps', Favorite && UserEmail = User().Email).AppName)

In this formula we are filtering the favorite apps from the UserApps list where Favorite is true AND (&&) the Email in the list is equal to the current user email.  This filtered table is then used to "feed" the Filter on the TestAppList which will compare if AppName is in the inner filter.

 

I hope that is what you are looking for.  If not, post back and we'll expand from there.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

3 REPLIES 3
Highlighted
Super User
Super User

Re: Filtering a gallery by using a value in another list

@cjnunn 

Can you explain a little more on Gallery2 - you state listing all of the apps in the TestAppsList.

Are you stating that only the apps that are marked as favorites should appear?

 

If so, your formula for the Items property should be the following:

Filter(TestAppList, AppName in Filter('UserApps', Favorite && UserEmail = User().Email).AppName)

In this formula we are filtering the favorite apps from the UserApps list where Favorite is true AND (&&) the Email in the list is equal to the current user email.  This filtered table is then used to "feed" the Filter on the TestAppList which will compare if AppName is in the inner filter.

 

I hope that is what you are looking for.  If not, post back and we'll expand from there.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

Highlighted
Frequent Visitor

Re: Filtering a gallery by using a value in another list

Hi, Randy.

 

Yes, Gallery2 should only show the apps that the user has marked as a favorite. Your formula did the trick. Thanks so much!

 

I think the problem was that I was approaching it from a database mindset. I was trying to use a concatenated field (User email and AppName) as a primary key to identify the record in the UserApps list. Then I created a hidden text box that held the concatenated value, and tried to use that to lookup the value in the UserApps list, instead of just using the user's email.

 

This is the working formula (slightly modified with actual column names):  

Filter(TestAppList, Title in Filter('UserApps', Favorite && User = User().Email).AppName)

 

Thanks again.

Highlighted
Super User
Super User

Re: Filtering a gallery by using a value in another list

@cjnunn 

Looks good!  Glad you were able to get it working.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

Helpful resources

Announcements
Ignite

Microsoft Ignite

This will be a conference that you do not want to miss!

secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (5,636)