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

Join two Sharepoint's lists, retrieve all the products of a user and display the categories with Distinct function

Hi all,

 

I have 2 lists on my SharePoint and I need to retrieve all the products of a single user (depends on the email inserted in the login) and display the categories of those products in a gallery items using Distinct. 

 

The idea should be (SQL speaking) to DISTINCT SELECT AllProducts.ProductCategory FROM AllProducts,PersonalProducts WHERE AllProducts.ProductID = PersonalProduct.ProductID AND ProductOwner = Username

 

I tried ClearCollect and AddColumns but the collection let the gallery displays also the empty records.

 

Thanks for helping,

OmarSaid

1 ACCEPTED SOLUTION

Accepted Solutions

Please follow these steps:

1. Onvisible of the Screen

ClearCollect(MyProductsNew,ProductsNew);
ClearCollect(MyOwners,Filter(PersonalProducts,ProductOwner=User().Email))
Onvisible.JPG
 
2. On the Items of the Gallery:
Filter(MyProductsNew ,ProductID in MyOwners.ProductID)
Gallery Item.JPG
------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

View solution in original post

4 REPLIES 4
Super User III
Super User III

To be more precise, can you display sample tables and how you want the output to be?

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Im sorry,

 

Screenshot 2020-06-26 at 18.27.26.pngUntitled.png

 

The output should be a table to be inserted into the Gallery Items containing all the ProductCategories of the products that an User has in PersonalProducts (I hided the emails because they real)

Please follow these steps:

1. Onvisible of the Screen

ClearCollect(MyProductsNew,ProductsNew);
ClearCollect(MyOwners,Filter(PersonalProducts,ProductOwner=User().Email))
Onvisible.JPG
 
2. On the Items of the Gallery:
Filter(MyProductsNew ,ProductID in MyOwners.ProductID)
Gallery Item.JPG
------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

View solution in original post

Life Saver. Thank you so much.

Helpful resources

Announcements
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (8,803)