cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
M_Lat45
Level: Powered On

Issue saving distinct values from a choices function (SharePoint lookup)

My Dropdown column is connected to a sharepoint list and pulling in a lookup column using

Choices(List.Column)

I'm attempting to remove duplicates using

Distinct(Choices(List.Column), Value)

This successfully removes duplicates, however it doesn't save the selected value.

 

I'd appreciate any assistance or insight into the nature of the table returned by distrinct.

I'm also open to alternative approaches.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Issue saving distinct values from a choices function (SharePoint lookup)

The DIstinct () function would return a table with single column (Column named as Result), while the Lookup field expects a table with the following schema:

{ID:"", Value:""}

 

To workaround this, please try the code below:

RenameColumns(
AddColumns( Distinct(Choices(Patchtesting.Lookup),Value), "Id", LookUp(Choices(Patchtesting.Lookup), Value=Result, Id)),
"Result",
"Value"
)

After that, check to see if the submit would work as expected.

 

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
4 REPLIES 4
Community Support Team
Community Support Team

Re: Issue saving distinct values from a choices function (SharePoint lookup)

The DIstinct () function would return a table with single column (Column named as Result), while the Lookup field expects a table with the following schema:

{ID:"", Value:""}

 

To workaround this, please try the code below:

RenameColumns(
AddColumns( Distinct(Choices(Patchtesting.Lookup),Value), "Id", LookUp(Choices(Patchtesting.Lookup), Value=Result, Id)),
"Result",
"Value"
)

After that, check to see if the submit would work as expected.

 

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
M_Lat45
Level: Powered On

Re: Issue saving distinct values from a choices function (SharePoint lookup)

Thanks @v-micsh-msft. I'll give this a try.

 

Out of curiosity, do you happen to know how I could find the schema returned by each formula, as well as expected by each control?

Community Support Team
Community Support Team

Re: Issue saving distinct values from a choices function (SharePoint lookup)

Apologize for the late response.

Have you tried the suggestion posted in my previous thread?

For the schema of the data you would like to work with,

Try to save the related data into a collection, then you could check the table schema under the Collection:

ClearCollect(Collection1, ActualResult)

PS: I remembered I have reponsed back for this thread, but on a second checking, the saved  Drafts is still in Preview. My bad for that.

 

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
rkarthi371
Level: Powered On

Re: Issue saving distinct values from a choices function (SharePoint lookup)

It works fine. But i ma unable to save the value for the look up field, Am i misseing anything else.?

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

PowerApps Monthly Community Call

Tomorrow, September 18th at 8am PDT

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

Users Online
Currently online: 119 members 3,810 guests
Please welcome our newest community members: