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.
3 REPLIES 3
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.