cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
StephenGW
Post Patron
Post Patron

Choices, distinct, and SharePoint list

I have a SP list and am using a custom PowerApps form. The column is a Choice column and when I leave items as Choices([@'Controlled Locations'].Department) it updates the list fine but when I add Distinct like this Distinct(Choices([@'Controlled Locations'].Department),Value) to remove the duplicates it no longer updates the list. All other properties are left to the default. Any ideas why or how I can make this work?

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions

Hey @StephenGW, despite my first post probably sharing more wisdom, I did find a solution to this elsewhere and wanted to share with you. 

 

In the Items property, keep Distinct(Choices([@'Controlled Locations'].Department),Value) as you have it.

In the Update property, write:

 

{
Value: yourlookupdatacard.Selected.Result,
Id:
LookUp(
'yourreferencelist',
thenameofthereferencecolumnwiththevaluethatmatchesyourselecteditem = yourlookupdatacard.Selected.Result
).ID
}

 

This way, it will update with a record even though the result of the distinct function is a value.

View solution in original post

5 REPLIES 5
Waegemma
Helper V
Helper V

Hi @StephenGW ,

 

I tried it too on a choice column:  no error message, choices are selectable but the list doesn't update.

I do wonder why you have a non-unique choices column: if it's somehow automatically filled, perhaps there's a way to filter distinct values at that time, instead of in the dropdown?

 

Succes,

 

Marc

 

Sorry, I misspoke it is a LookUp column looking at a SP list of locations. So the first column is similar to a city with the second column being like a building and finally the last column is the building directory. So the first column would have many repeats of say New York and then several buildings in the second column which would also then repeat some too like building 1, building 2, ect. Then the third column would be like room12, room 13, ect. I'm not sure I can filter these this way.

 

Anybody have any ideas why it won't work when I try to remove the duplicates?

Hi Stephen,

 

I've had an almost identical situation. I believe the issue is due to the distinct function giving an output of distinct text values. The filter function will do the same thing. The problem there is that the SP list wants a record. Unfortunately, I haven't found a solution. See the thread I made here.

 

 

Hey @StephenGW, despite my first post probably sharing more wisdom, I did find a solution to this elsewhere and wanted to share with you. 

 

In the Items property, keep Distinct(Choices([@'Controlled Locations'].Department),Value) as you have it.

In the Update property, write:

 

{
Value: yourlookupdatacard.Selected.Result,
Id:
LookUp(
'yourreferencelist',
thenameofthereferencecolumnwiththevaluethatmatchesyourselecteditem = yourlookupdatacard.Selected.Result
).ID
}

 

This way, it will update with a record even though the result of the distinct function is a value.

That did it! Thank you for this solution!

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (3,120)