cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
bcanfield83
Helper I
Helper I

SharePoint Multi-Select Lookup Column Issue

Hi All,

 

The form submits to a SharePoint list ("Requests") which includes a Lookup column named Sub_Application. This column has the following properties set: 

  • Get information from: Ref_Sub_Applications 
  • In this column: Title
  • Allow multiple values: TRUE

 

The initial screen contains a multi-select ComboBox control (cboPasaReqSubApp) that pulls values from the "Ref_Sub_Applications" list, with the Title column as the Display Value.

If the user selects multiple values from this ComboBox, all of those values should be listed in the aforementioned Lookup column (Sub_Application) once the form has been submitted.

The problem I'm running into is that regardless of the # of selections made from this ComboBox, the Sub_Application Lookup column is only reflecting the last selection that was made upon submission of the form.

 

When the user proceeds to the next (and final) screen, I'm using the below to create a collection for the selected records from the ComboBox: 

 

ForAll(
cboPasaReqSubApp.SelectedItems,
Collect(
colSelectedSubApps,
{
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Id: cboPasaReqSubApp.Selected.ID,
Value: cboPasaReqSubApp.Selected.Title
}
)
)

 

When I view the collection (colSelectedSubApps), it's essentially showing duplicate values. For example, if the user selects two records from the ComboBox whose respective "Id" values are 4 and 7, the collection shows two records - but both records have the same Id and Value (representing whichever item was selected last from the ComboBox). 

 

I'm not entirely sure where I'm going astray, so any help would be appreciated 😞

 

Thanks! 

 

1 ACCEPTED SOLUTION

Accepted Solutions
WiZey
Super User
Super User

Hello @bcanfield83 ,

 

You made a typo in your "ForAll()". 

 

Basically, you can access the read record inside the "ForAll()" loop with "ThisRecord". However, you're using "cboPasaReqSubApp", which tells the program for each item to reference the combobox instead of the read item.

 

Try replacing the "cboPasaReqSubApp.Selected" by "ThisRecord" and see how it goes.

View solution in original post

2 REPLIES 2
WiZey
Super User
Super User

Hello @bcanfield83 ,

 

You made a typo in your "ForAll()". 

 

Basically, you can access the read record inside the "ForAll()" loop with "ThisRecord". However, you're using "cboPasaReqSubApp", which tells the program for each item to reference the combobox instead of the read item.

 

Try replacing the "cboPasaReqSubApp.Selected" by "ThisRecord" and see how it goes.

@WiZey - thank you, this looks to have resolved the issue! The collection is now reflecting the record(s) selected from cboPasaReqSubApp.

This is the updated formula that I'm using in the "OnChange" property of cboPasaReqSubApp:

 

ForAll(cboPasaReqSubApp.SelectedItems,
Collect(colSelectedSubApps,
{'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Id: ThisRecord.ID,
Value: ThisRecord.Title
}))

 

For some reason, it's creating duplicate records, i.e.: when I selected two records from the ComboBox whose Id values are 5 and 7, it added a duplicate entry for the former (thus, there's 3 records in the collection even though I only selected two choices from cboPasaReqSubApp) 

I can probably use the "Distinct" function to workaround that though. 

colSelectedSubApps_Duplicate_Record2.PNG

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (5,375)