cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
codebrane
Level 8

How to only show first occurrence of each DataSource field in gallery list

My backing Sharepoint list has multiple occurrences of StudentId so when I use the list from a PowerApps gallery, I get all the occurences, leading to dupliace entries for the multiple StudentId, as expected. Is there a way to use Distinct without knowing the StudentId to make the gallery only show the first occurrence of each StudentId?

 

e.g, in SQL it would be along the lines of SELECT DISTINCT StudentId. Is there an equivalent for PowerApps?

 

thanks,

 

Alistair

 

1 ACCEPTED SOLUTION

Accepted Solutions
codebrane
Level 8

Re: How to only show first occurrence of each DataSource field in gallery list

Turns out it was fairly easy. In the Items for the list:

 

If (IsBlank(TextSearchBox1.Text), Distinct('The List', StudentId), Distinct(Filter('The List', TextSearchBox1.Text in Text(StudentId)), StudentId))

then in the list tem Text I initially had:

 

ThisItem.StudentId

 but that no longer works as Distinct returns a Table so the final part of the solution is to set the list item Text to:

 

Result

The above now displays only a single instance of a StudentId when there are multiple entries in the Sharepoint list.

 

View solution in original post

1 REPLY 1
codebrane
Level 8

Re: How to only show first occurrence of each DataSource field in gallery list

Turns out it was fairly easy. In the Items for the list:

 

If (IsBlank(TextSearchBox1.Text), Distinct('The List', StudentId), Distinct(Filter('The List', TextSearchBox1.Text in Text(StudentId)), StudentId))

then in the list tem Text I initially had:

 

ThisItem.StudentId

 but that no longer works as Distinct returns a Table so the final part of the solution is to set the list item Text to:

 

Result

The above now displays only a single instance of a StudentId when there are multiple entries in the Sharepoint list.

 

View solution in original post

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,238)