cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Resolver I
Resolver I

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
Highlighted
Resolver I
Resolver I

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
Highlighted
Resolver I
Resolver I

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
secondImage

New Return to Workplace

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

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 (7,743)