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

 

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.

 

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 46 members 4,975 guests
Please welcome our newest community members: