cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted

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
Highlighted
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.

Highlighted

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)

Highlighted

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

Highlighted

Life Saver. Thank you so much.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

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

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (16,358)